Affects versions down to r8 : $ cat z1.cc template <template <class> class a> struct [[b]] a <int>; $ g++-11-20201213 -c z1.cc z1.cc:1:50: internal compiler error: Segmentation fault 1 | template <template <class> class a> struct [[b]] a <int>; | ^~~~~~~ 0xc8f5ff crash_signal ../../gcc/toplev.c:327 0x7507a5 cp_parser_elaborated_type_specifier ../../gcc/cp/parser.c:19653 0x739283 cp_parser_type_specifier ../../gcc/cp/parser.c:18393 0x73a0b6 cp_parser_decl_specifier_seq ../../gcc/cp/parser.c:14990 0x75bd05 cp_parser_single_declaration ../../gcc/cp/parser.c:30321 0x75c095 cp_parser_template_declaration_after_parameters ../../gcc/cp/parser.c:29984 0x75c84b cp_parser_explicit_template_declaration ../../gcc/cp/parser.c:30250 0x75c84b cp_parser_template_declaration_after_export ../../gcc/cp/parser.c:30269 0x75ecf9 cp_parser_declaration ../../gcc/cp/parser.c:13996 0x75e183 cp_parser_translation_unit ../../gcc/cp/parser.c:4926 0x75e183 c_parse_file() ../../gcc/cp/parser.c:45106 0x82acf2 c_common_parse_file() ../../gcc/c-family/c-opts.c:1211
Confirmed.
Likely started with r8-2567-g776ff3efa9de7fce.
Fixed trunk, 8d8bb85b486 2020-12-16 | c++: Fix template parm ICE [PR 98297] backports to 10, 9, & 8 in progress
8, 9 & 10 fixed
Note, the testcase FAILs on the 8 branch, the emitted error is different. $ gcc-9/obj28/gcc/cc1plus -quiet -std=c++11 /tmp/pr98297.C -o /tmp/pr98297.s /tmp/pr98297.C:5:1: warning: ‘b’ attribute directive ignored [-Wattributes] 5 | a <int>; // { dg-error "does not declare anything" } | ^~~~~~~ /tmp/pr98297.C:5:1: error: declaration does not declare anything [-fpermissive] $ gcc-8/obj32/gcc/cc1plus -quiet -std=c++11 /tmp/pr98297.C -o /tmp/pr98297.s /tmp/pr98297.C:5:1: warning: ‘b’ attribute directive ignored [-Wattributes] a <int>; // { dg-error "does not declare anything" } ^~~~~~~ /tmp/pr98297.C:5:1: error: name of class shadows template template parameter ‘a’ $ gcc-8/obj30/gcc/cc1plus -quiet -std=c++11 /tmp/pr98297.C -o /tmp/pr98297.s /tmp/pr98297.C:5:1: internal compiler error: Segmentation fault a <int>; // { dg-error "does not declare anything" } ^~~~~~~ gcc-8/obj30 is 5 months old snapshot which expectedly ICEs, but the middle error is different from what the test expects.
Ah, tracked already in PR98358.