From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by sourceware.org (Postfix) with ESMTP id 35A903857C62 for ; Mon, 14 Sep 2020 16:49:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 35A903857C62 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-580-ytSjO7BSNgysFQ3j117DPw-1; Mon, 14 Sep 2020 12:49:21 -0400 X-MC-Unique: ytSjO7BSNgysFQ3j117DPw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 35FED802B5D; Mon, 14 Sep 2020 16:49:20 +0000 (UTC) Received: from redhat.com (ovpn-119-180.rdu2.redhat.com [10.10.119.180]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B95C87BE76; Mon, 14 Sep 2020 16:49:19 +0000 (UTC) Date: Mon, 14 Sep 2020 12:49:17 -0400 From: Marek Polacek To: Nathan Sidwell Cc: GCC Patches Subject: Re: c++: local externs in templates do not get template head Message-ID: <20200914164917.GI5926@redhat.com> References: <0de116c2-d345-12fe-1efe-b4a545b4bd87@acm.org> MIME-Version: 1.0 In-Reply-To: <0de116c2-d345-12fe-1efe-b4a545b4bd87@acm.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-14.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2020 16:49:26 -0000 On Mon, Sep 14, 2020 at 12:45:33PM -0400, Nathan Sidwell wrote: > Now we consistently mark local externs with DECL_LOCAL_DECL_P, we can > teach the template machinery not to give them a TEMPLATE_DECL head, > and the instantiation machinery treat them as the local specialiations > they are. (openmp UDRs also fall into this category, and are dealt > with similarly.) > > gcc/cp/ > * pt.c (push_template_decl_real): Don't attach a template head to > local externs. > (tsubst_function_decl): Add support for headless local extern > decls. > (tsubst_decl): Add support for headless local extern decls. > > pushed to trunk > -- > Nathan Sidwell > diff --git i/gcc/cp/pt.c w/gcc/cp/pt.c > index 0f52a9ed77d..8124efcbe24 100644 > --- i/gcc/cp/pt.c > +++ w/gcc/cp/pt.c > @@ -6071,7 +6071,11 @@ push_template_decl_real (tree decl, bool is_friend) > { > if (is_primary) > retrofit_lang_decl (decl); > - if (DECL_LANG_SPECIFIC (decl)) > + if (DECL_LANG_SPECIFIC (decl) > + && ((TREE_CODE (decl) != VAR_DECL > + && TREE_CODE (decl) != FUNCTION_DECL) This is !VAR_OR_FUNCTION_DECL_P. Want me to "fix" that as obvious? Marek