https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85264

            Bug ID: 85264
           Summary: [7/8 Regression] ICE with extraneous template
                    parameter list
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org
  Target Milestone: ---

The following invalid code snippet triggers an ICE since GCC 7.1.0:

=========================================================
template<typename> struct A {};

template<int>
template<typename... T> struct A<void(T...)> {};

A<void(int)> a;
=========================================================

bug.cc: In substitution of 'template<int <anonymous> > template<class ... T>
struct A<void(T ...)> [with T = <missing>; int <anonymous> = {int}]':
bug.cc:6:14:   required from here
bug.cc:6:14: internal compiler error: in tsubst_pack_expansion, at
cp/pt.c:11875
 A<void(int)> a;
              ^
0x644533 tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/gcc/cp/pt.c:11875
0x96952a tsubst_arg_types
        ../../gcc/gcc/cp/pt.c:13549
0x96973d tsubst_function_type
        ../../gcc/gcc/cp/pt.c:13711
0x96a1c3 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/gcc/cp/pt.c:14440
0x979422 tsubst_template_args
        ../../gcc/gcc/cp/pt.c:12137
0x96a855 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/gcc/cp/pt.c:14301
0x986c57 get_partial_spec_bindings
        ../../gcc/gcc/cp/pt.c:22385
0x987176 most_specialized_partial_spec
        ../../gcc/gcc/cp/pt.c:22618
0x99107f instantiate_class_template_1
        ../../gcc/gcc/cp/pt.c:10567
0x99107f instantiate_class_template(tree_node*)
        ../../gcc/gcc/cp/pt.c:11100
0x9d8b6d complete_type(tree_node*)
        ../../gcc/gcc/cp/typeck.c:136
0x885e67 start_decl_1(tree_node*, bool)
        ../../gcc/gcc/cp/decl.c:5275
0x8ac107 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
        ../../gcc/gcc/cp/decl.c:5238
0x93d1b3 cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:19610
0x944988 cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:13049
0x945798 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:12874
0x949722 cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:12772
0x949b31 cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:12648
0x949e24 cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:4563
0x949e24 c_parse_file()
        ../../gcc/gcc/cp/parser.c:39029
Please submit a full bug report, [etc.]

Before, the code was wrongly accepted.
If I use regular template parameters instead of parameter packs, the code
is also wrongly accepted (since at least GCC 3.1.1).

Reply via email to