From patchwork Tue Jan 23 14:06:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 864805 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-471885-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="gPU0bIii"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zQqqC3n6vz9s4s for ; Wed, 24 Jan 2018 01:06:47 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=fhas1B8Vr+eeyaqIeOBGlYQoU+gAs3Nb6P0vIvcYrRq9pegVsx infFf4nNUh5tJbOCSfgGgZfXAapwUkGF8YkJ+wdE34WhKbtA4eUE27pXRdHKuB9F oaKU5tzSxZfsYED+oF4g18LWqMR7cu34pzzxEujpswy/BFwuVnjdgNSx4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=TVR6MTh71DQ4TZzTriiWLIjIOVY=; b=gPU0bIii8pG7wdu3uzkI Qs91BwAyRgcvVxokDyQVchEN5zKicBfIhCwvm+7ni/qlL8N0FXbeIN7MkZK/ozcK Iwl2Q1UpWYW1kpd0zdDrV499c+iPYE1i0X2b3RpKAKEoNNqSZsRVAgYNHJne60uN x/cUF75XoYgUJZzmjihiHdg= Received: (qmail 22999 invoked by alias); 23 Jan 2018 14:06:40 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 22925 invoked by uid 89); 23 Jan 2018 14:06:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=We're X-HELO: mail-yb0-f175.google.com Received: from mail-yb0-f175.google.com (HELO mail-yb0-f175.google.com) (209.85.213.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 23 Jan 2018 14:06:38 +0000 Received: by mail-yb0-f175.google.com with SMTP id l3so212311ybk.5 for ; Tue, 23 Jan 2018 06:06:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:to:from:subject:message-id:date :user-agent:mime-version:content-language; bh=zoqSIZLy+LODRjmEljYsIC80JOBWgKm92iBKULlGzQM=; b=pt9Rj81nMR8NdTE1TJE5VvFoJfMc6L/RtIAE/kWQik9x/Ur4g4ISCaRLxaUG/+erFI ZpCbAYYpP/+f1xREDbxcXGyyM/+WrfE2fB6W8k/w02bE3fSNZTWqN85uR/KMGjk6d+Cz lL4pIDjtFyKKkPBARcszjjezER25fkShuMcsoTPc6/legsASDuwsCPdt0xhN0g53qQ9w 6x8UpoFYi6M89mYu8vTC2Y+ZJTZoalLgyGlcp813+ipW8ErWkLSXXWFxWIXtzPcPXtDi Eq+YZIqWIQFZtHs1WNg9DPKeFQ+ov/JWs1bSbO3ELeaoJjxU3HibjsEQjfCDCsXncEHT 0IMA== X-Gm-Message-State: AKwxyteEdrXFyeoavVLrggQ9eZv7ay2cjQgAx1YWfDHl5yDc2/6KAXmI p89UzTfCM5u2bgnNCSnjd30= X-Google-Smtp-Source: AH8x226wlcqKNxd+WilTTnEqBWZ15y3azepJkkLSDzWL8Lfzga45KZuXW7x2mE+HiqJmEJAqDMSHNQ== X-Received: by 10.37.63.131 with SMTP id m125mr2534006yba.120.1516716396587; Tue, 23 Jan 2018 06:06:36 -0800 (PST) Received: from ?IPv6:2620:10d:c0a3:20fb:7500:e7fb:4a6f:2254? ([2620:10d:c091:200::2:280f]) by smtp.googlemail.com with ESMTPSA id i193sm7406286ywe.62.2018.01.23.06.06.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Jan 2018 06:06:35 -0800 (PST) To: GCC Patches From: Nathan Sidwell Subject: [PR c++/839888] Baselink tsubst ICE Message-ID: <43616a29-9a36-f3d7-47f6-7463ea725919@acm.org> Date: Tue, 23 Jan 2018 09:06:34 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 I added an assert when recently fixing baselink substitution, but the assert is incorrect as this testcase shows. Fixing thusly. nathan 2018-01-23 Nathan Sidwell PR c++/83988 * pt.c (tsubst_baselink): Remove optype assert. * ptree.c (cxx_print_xnode): Print BASELINK_OPTYPE. PR c++/83988 * g++.dg/template/pr83988.C: New. Index: cp/pt.c =================================================================== --- cp/pt.c (revision 256981) +++ cp/pt.c (working copy) @@ -14447,11 +14447,8 @@ tsubst_baselink (tree baselink, tree obj fns = BASELINK_FUNCTIONS (baselink); } else - { - gcc_assert (optype == BASELINK_OPTYPE (baselink)); - /* We're going to overwrite pieces below, make a duplicate. */ - baselink = copy_node (baselink); - } + /* We're going to overwrite pieces below, make a duplicate. */ + baselink = copy_node (baselink); /* If lookup found a single function, mark it as used at this point. (If lookup found multiple functions the one selected later by Index: cp/ptree.c =================================================================== --- cp/ptree.c (revision 256981) +++ cp/ptree.c (working copy) @@ -215,6 +215,7 @@ cxx_print_xnode (FILE *file, tree node, print_node (file, "binfo", BASELINK_BINFO (node), indent + 4); print_node (file, "access_binfo", BASELINK_ACCESS_BINFO (node), indent + 4); + print_node (file, "optype", BASELINK_OPTYPE (node), indent + 4); break; case OVERLOAD: print_node (file, "function", OVL_FUNCTION (node), indent+4); Index: testsuite/g++.dg/template/pr83988.C =================================================================== --- testsuite/g++.dg/template/pr83988.C (revision 0) +++ testsuite/g++.dg/template/pr83988.C (working copy) @@ -0,0 +1,16 @@ +// PR 83988 ICE + +template struct optional {}; +struct get_from_json { + template + operator optional() const {return optional ();} + template + optional maybe() const + { + return this->operator optional(); + } +}; +void test() +{ + get_from_json().maybe(); +}