From patchwork Wed Dec 29 02:17:24 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 76876 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 22F501007D2 for ; Wed, 29 Dec 2010 13:17:34 +1100 (EST) Received: (qmail 16496 invoked by alias); 29 Dec 2010 02:17:32 -0000 Received: (qmail 16488 invoked by uid 22791); 29 Dec 2010 02:17:31 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 29 Dec 2010 02:17:27 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oBT2HPQf017280 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 28 Dec 2010 21:17:25 -0500 Received: from [127.0.0.1] (ovpn-113-106.phx2.redhat.com [10.3.113.106]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oBT2HPSa028160 for ; Tue, 28 Dec 2010 21:17:25 -0500 Message-ID: <4D1A9A34.90204@redhat.com> Date: Tue, 28 Dec 2010 21:17:24 -0500 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b2 Thunderbird/3.1.7 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/47068 (ICE with decltype of destructor name) 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 maybe_note_name_used_in_class assumes that its argument is, in fact, a name, not just an id-expression, so we shouldn't call it for non-names. Tested x86_64-pc-linux-gnu, applied to trunk. commit c22af743cd576b2a1c5e22f1a005020ec1f9a77f Author: Jason Merrill Date: Tue Dec 28 18:47:13 2010 -0500 PR c++/47068 * semantics.c (finish_id_expression): Don't note non-names as being used in the class. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 93493fb..aeb10fe 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2797,7 +2797,8 @@ finish_id_expression (tree id_expression, the current class so that we can check later to see if the meaning would have been different after the class was entirely defined. */ - if (!scope && decl != error_mark_node) + if (!scope && decl != error_mark_node + && TREE_CODE (id_expression) == IDENTIFIER_NODE) maybe_note_name_used_in_class (id_expression, decl); /* Disallow uses of local variables from containing functions, except diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype24.C b/gcc/testsuite/g++.dg/cpp0x/decltype24.C new file mode 100644 index 0000000..16d0736 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype24.C @@ -0,0 +1,7 @@ +// PR c++/47068 +// { dg-options -std=c++0x } + +template struct broken { + int member; + typedef decltype(~ member) gcc_crashes_here; +};