c++: local externs in templates do not get template head
Nathan Sidwell
nathan@acm.org
Mon Sep 14 16:53:18 GMT 2020
On 9/14/20 12:49 PM, Marek Polacek wrote:
> 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?
ah, thanks -- great. I knew of VAR_P and the lack of FUNCTION_P, but
not that one. (bah, who needs consistency!)
--
Nathan Sidwell
More information about the Gcc-patches
mailing list