mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-23 19:03:59 +08:00
c++: Fix template parm ICE [PR 98297]
I think this is nonsense code, we seem to be naming an instantiation of a template template parm. But this fixes the ICE. Perhaps we should diagnose the issue earlier? gcc/cp/ * parser.c (cp_parser_elaborated_type_specifier): Test BOUND_TEMPLATE_TEMPLATE_PARM before checking for instantiation. gcc/testsuite/ * g++.dg/template/pr98297.C: New.
This commit is contained in:
parent
3f78c8cb7f
commit
8d8bb85b48
@ -19650,7 +19650,9 @@ cp_parser_elaborated_type_specifier (cp_parser* parser,
|
||||
if (TREE_CODE (type) == TYPENAME_TYPE)
|
||||
warning (OPT_Wattributes,
|
||||
"attributes ignored on uninstantiated type");
|
||||
else if (tag_type != enum_type && CLASSTYPE_TEMPLATE_INSTANTIATION (type)
|
||||
else if (tag_type != enum_type
|
||||
&& TREE_CODE (type) != BOUND_TEMPLATE_TEMPLATE_PARM
|
||||
&& CLASSTYPE_TEMPLATE_INSTANTIATION (type)
|
||||
&& ! processing_explicit_instantiation)
|
||||
warning (OPT_Wattributes,
|
||||
"attributes ignored on template instantiation");
|
||||
|
6
gcc/testsuite/g++.dg/template/pr98297.C
Normal file
6
gcc/testsuite/g++.dg/template/pr98297.C
Normal file
@ -0,0 +1,6 @@
|
||||
// PR 98297, ICE
|
||||
// { dg-do compile { target c++11 } }
|
||||
template <template <class> class a>
|
||||
struct [[b]]
|
||||
a <int>; // { dg-error "does not declare anything" }
|
||||
// { dg-warning "ignored" "" { target *-*-* } .-1 }
|
Loading…
Reference in New Issue
Block a user