From patchwork Wed Jun 20 01:17:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 165869 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 B15FBB7010 for ; Wed, 20 Jun 2012 11:17:52 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1340759874; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=rf3dfz0 IJ2iIfbu+ualgERzBraU=; b=wqc2arYOZn6UJMbZREAnvyEigx/u1epWFCJwLNs ZtF9/LCdZrrypoUPrpf6FMtt1agPtlz1H6pv4lX04ChZMvGEOL8ouPBOcYELO30l szKg7gPDRM/7I0M8JAix8qQRvMMmyD2SQxar5zJATCGRf0tH1MlYzJoqxDKhq541 aoaM= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=KceBCaN1xefLhg/mV59emxdPZO7ljw4J42KC6DCI2KiP0t9gXy7SvQF2NIm+kJ +MY8CKaDhVHnVLuL+hZoCCmY5DsZjCaoF/Pdobk+GRTDOGD9WmCLNAgldg7gBaYP uXIS3w+zjaBzPow8knnjwB9KGVv2TuUiPkLqIFipQO/MI=; Received: (qmail 4360 invoked by alias); 20 Jun 2012 01:17:49 -0000 Received: (qmail 4349 invoked by uid 22791); 20 Jun 2012 01:17:48 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, 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, 20 Jun 2012 01:17:34 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q5K1HYRU006830 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 19 Jun 2012 21:17:34 -0400 Received: from [10.3.113.88] (ovpn-113-88.phx2.redhat.com [10.3.113.88]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q5K1HXqe003208 for ; Tue, 19 Jun 2012 21:17:33 -0400 Message-ID: <4FE124AD.5040808@redhat.com> Date: Tue, 19 Jun 2012 18:17:33 -0700 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/53651 (ICE with ill-formed use of decltype) 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 A decltype doesn't have a name. Tested x86_64-pc-linux-gnu, applying to trunk and 4.7. commit bab2f5e9e77bd41b91ca6eae34483eb159307519 Author: Jason Merrill Date: Thu Jun 14 17:28:08 2012 -0700 PR c++/53651 * name-lookup.c (constructor_name_p): Don't try to look at the name of a DECLTYPE_TYPE. diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 0f28820..cc8439c 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -1966,6 +1966,11 @@ constructor_name_p (tree name, tree type) if (TREE_CODE (name) != IDENTIFIER_NODE) return false; + /* These don't have names. */ + if (TREE_CODE (type) == DECLTYPE_TYPE + || TREE_CODE (type) == TYPEOF_TYPE) + return false; + ctor_name = constructor_name_full (type); if (name == ctor_name) return true; diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype37.C b/gcc/testsuite/g++.dg/cpp0x/decltype37.C new file mode 100644 index 0000000..c885e9a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype37.C @@ -0,0 +1,14 @@ +// PR c++/53651 +// { dg-do compile { target c++11 } } + +template struct wrap { void bar(); }; + +template auto foo(T* t) -> wrap* { return 0; } + +template +struct holder : decltype(*foo((T*)0)) // { dg-error "class type" } +{ + using decltype(*foo((T*)0))::bar; // { dg-error "is not a base" } +}; + +holder h;