From patchwork Tue Apr 30 20:49:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 240688 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id F40542C00A8 for ; Wed, 1 May 2013 06:49:41 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; q=dns; s=default; b=UiukzR5a++cX3Diw2 0nRLCrq8nDpBmYves10k0bCbekhguU1MPRZKkHJRZ1EAtpDL2IKUoX39eghmsZ97 sBuifVqvP00RVmqWzlWgkz7KhzL1/Hfw3a4W3h68UACQKEmpmBh6HJbaEQna7gkP ZNwdaWS95EE4H+9jvf+Pz47axo= 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 :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; s=default; bh=OMbPJyBO7nU9j3zbcImFNvP fkXs=; b=rQb82McP+StV5h3Nw4PADFgucDbd2sYq+awt+ecf+tTch0cnN+32gRl S1zlOqsb2Lsc61XrHEdDnrTCBHqBm6Eg5fjNFIOCf4/Jr2BCLnnifZJWRDRqbSJ1 8yYs59VJc5NG2QyvlcUpggRRC8QFOSXU/7N6oWGPbAoZ4HHI8JUU= Received: (qmail 12967 invoked by alias); 30 Apr 2013 20:49:34 -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 12957 invoked by uid 89); 30 Apr 2013 20:49:34 -0000 X-Spam-SWARE-Status: No, score=-7.4 required=5.0 tests=AWL, BAYES_00, KHOP_THREADED, RCVD_IN_DNSWL_MED, RCVD_IN_HOSTKARMA_NO, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, SPF_PASS, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 30 Apr 2013 20:49:33 +0000 Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r3UKnU5X027891 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 30 Apr 2013 20:49:31 GMT Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r3UKnTNX011785 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Tue, 30 Apr 2013 20:49:30 GMT Received: from abhmt103.oracle.com (abhmt103.oracle.com [141.146.116.55]) by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r3UKnTCD007419; Tue, 30 Apr 2013 20:49:29 GMT Received: from poldo4.casa (/79.47.194.76) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 30 Apr 2013 13:49:29 -0700 Message-ID: <51802E57.9010407@oracle.com> Date: Tue, 30 Apr 2013 22:49:27 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: Jason Merrill CC: "gcc-patches@gcc.gnu.org" Subject: Re: [C++ Patch/RFC] PR 57092 References: <517E37C7.7000001@oracle.com> <517E883B.7020702@redhat.com> <517FB328.8030105@oracle.com> <517FC3AE.9010306@redhat.com> <517FEA51.5050001@oracle.com> <51801411.8030508@redhat.com> In-Reply-To: <51801411.8030508@redhat.com> X-Virus-Found: No Hi, On 04/30/2013 08:57 PM, Jason Merrill wrote: > On 04/30/2013 11:59 AM, Paolo Carlini wrote: >> Currently, in some cases (see, eg, template/canon-type-9.C) we have that >> id is true and DECLTYPE_TYPE_EXPR (t) is a TEMPLATE_PARM_INDEX but the >> tsubst_copy_and_build call returns a TEMPLATE_PARM_INDEX again, not an >> ADDR_EXPR, not an expression > > Good point, this can happen for partial instantiations, when > processing_template_decl is still true. We want to keep the > DECLTYPE_TYPE around until the expression instantiates to something > non-instantiation-dependent. I see... > Hmm. Maybe the right answer is to just add a default: case to > finish_decltype_type and trust that it will be right. Ok. Then shall we do something like the below? Thanks, Paolo. ////////////////// Index: cp/semantics.c =================================================================== --- cp/semantics.c (revision 198469) +++ cp/semantics.c (working copy) @@ -5416,8 +5416,8 @@ finish_decltype_type (tree expr, bool id_expressio break; default: - gcc_unreachable (); - return error_mark_node; + type = TREE_TYPE (expr); + break; } } else Index: testsuite/g++.dg/cpp0x/decltype53.C =================================================================== --- testsuite/g++.dg/cpp0x/decltype53.C (revision 0) +++ testsuite/g++.dg/cpp0x/decltype53.C (working copy) @@ -0,0 +1,11 @@ +// PR c++/57092 +// { dg-do compile { target c++11 } } + +template +class B { + decltype(F) v; +}; + +void foo(int) {} + +B o;