From patchwork Wed Aug 2 21:15:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 796868 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-459678-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="lutuEzi4"; 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 3xN5Zk0kl7z9s8V for ; Thu, 3 Aug 2017 07:15:56 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=v4CqA1BRgyH18AzcIy2lNgBrIEZSx6/DbqSccctk6+HeyAeEP8 BlkIakgv6GEsSlhypE7e4o46WLM4k5r51J8QEbTh1B47GyUY5sA/oRPHJLCUWTpu boLuXqc8nzEvSkRUzoZDRl8OoHTlYkJZACKSsIgcZS0T+y1YIKBHw2uwI= 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:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=CrOQKayOZj8P+4rIiEq4xhIIpGE=; b=lutuEzi4sxgxZb0+Niu5 RuvOILFgZfFuij1G7MB51i+Gt9L94itF5k8r5AxidloXqvGyEBcUPx7qD1K8XKd5 azlbG7RzIRc7zuhCi14ZOZrqrLuEG+FgRoqo9OXYwihNqNrlVpk6Ou220kkro9/F WX44XvIsJJBM/3z8bCErjnE= Received: (qmail 46156 invoked by alias); 2 Aug 2017 21:15:37 -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 46062 invoked by uid 89); 2 Aug 2017 21:15:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.6 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_SORBS_SPAM, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: aserp1040.oracle.com Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 02 Aug 2017 21:15:22 +0000 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v72LFBNP003474 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 2 Aug 2017 21:15:12 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v72LFBu1008313 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 2 Aug 2017 21:15:11 GMT Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v72LFARb012322; Wed, 2 Aug 2017 21:15:10 GMT Received: from [192.168.1.4] (/79.53.235.194) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 02 Aug 2017 14:15:10 -0700 To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill From: Paolo Carlini Subject: [C++ Patch] PR 71440 ("ICE on invalid C++ code in instantiate_type, at cp/class.c...") Message-ID: <2e8f6d3a-2a87-1238-8576-036db2c4fca4@oracle.com> Date: Wed, 2 Aug 2017 23:15:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 X-IsSubscribed: yes Hi, by and large this issue seems already fixed in mainline, ie, we don't ICE anymore during error recovery, but I noticed that we try to prettyprint constructor and destructor as expressions and we end up with ugliness like: error: taking address of constructor ‘((C*)this)->*A::__ct ’ thus the below, tested x86_64-linux. Ok? Thanks, Paolo. //////////////////// /cp 2017-08-02 Paolo Carlini PR c++/71440 * typeck.c (build_x_unary_op): Avoid pretty-printing constructor / destructor as expressions. /testsuite 2017-08-02 Paolo Carlini PR c++/71440 * g++.dg/template/crash127.C: New. Index: cp/typeck.c =================================================================== --- cp/typeck.c (revision 250787) +++ cp/typeck.c (working copy) @@ -5487,9 +5487,9 @@ build_x_unary_op (location_t loc, enum tree_code c { if (complain & tf_error) error (DECL_CONSTRUCTOR_P (fn) - ? G_("taking address of constructor %qE") - : G_("taking address of destructor %qE"), - xarg.get_value ()); + ? G_("taking address of constructor %qD") + : G_("taking address of destructor %qD"), + fn); return error_mark_node; } } Index: testsuite/g++.dg/template/crash127.C =================================================================== --- testsuite/g++.dg/template/crash127.C (revision 0) +++ testsuite/g++.dg/template/crash127.C (working copy) @@ -0,0 +1,22 @@ +// PR c++/71440 + +struct A +{ + void f () {} +}; + +typedef void (A::*Ptr) (); + +template < Ptr > struct B {}; + +template < class T > +struct C : public A +{ + void bar () + { + B < &A::A > b; // { dg-error "taking address of constructor 'A::A" "" { target c++98_only } } + // { dg-error "taking address of constructor 'constexpr A::A" "" { target c++11 } .-1 } + } +}; + +template class C < int >;