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

            Bug ID: 84652
           Summary: internal compiler error: in cp_parser_template_id, at
                    cp/parser.c:15860
           Product: gcc
           Version: 8.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vegard.nossum at gmail dot com
  Target Milestone: ---

Input:

template<int>
int a(a<class b {}>);

Output:

$ xgcc -x c++ -S -
<stdin>:2:17: error: types may not be defined in template arguments
<stdin>:2:19: error: expected ';' after class definition
<stdin>:2:18: error: expected template-argument before ';' token
<stdin>:2:18: error: expected '>' before ';' token
<stdin>:2:18: internal compiler error: in cp_parser_template_id, at
cp/parser.c:15860
0xf4b7eb cp_parser_template_id
        /home/vegard/git/gcc/gcc/cp/parser.c:15858
0xf4bc5a cp_parser_class_name
        /home/vegard/git/gcc/gcc/cp/parser.c:22364
0xf7fc4d cp_parser_qualifying_entity
        /home/vegard/git/gcc/gcc/cp/parser.c:6583
0xf7fc4d cp_parser_nested_name_specifier_opt
        /home/vegard/git/gcc/gcc/cp/parser.c:6267
0xf31bf5 cp_parser_simple_type_specifier
        /home/vegard/git/gcc/gcc/cp/parser.c:17168
0xf7a096 cp_parser_postfix_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:6949
0xf2e057 cp_parser_unary_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:8320
0xec31aa cp_parser_cast_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:9088
0xec57d6 cp_parser_binary_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:9189
0xec95aa cp_parser_assignment_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:9484
0xecf383 cp_parser_constant_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:9768
0xed6a4b cp_parser_parenthesized_expression_list
        /home/vegard/git/gcc/gcc/cp/parser.c:7756
0xedf59c cp_parser_initializer
        /home/vegard/git/gcc/gcc/cp/parser.c:21855
0xfa4eed cp_parser_init_declarator
        /home/vegard/git/gcc/gcc/cp/parser.c:19668
0xfa75c9 cp_parser_single_declaration
        /home/vegard/git/gcc/gcc/cp/parser.c:27272
0xfc93d8 cp_parser_template_declaration_after_parameters
        /home/vegard/git/gcc/gcc/cp/parser.c:26867
0xfc79db cp_parser_explicit_template_declaration
        /home/vegard/git/gcc/gcc/cp/parser.c:27105
0xfc79db cp_parser_template_declaration_after_export
        /home/vegard/git/gcc/gcc/cp/parser.c:27123
0x1003081 cp_parser_declaration
        /home/vegard/git/gcc/gcc/cp/parser.c:12727
0xff9bdb cp_parser_declaration_seq_opt
        /home/vegard/git/gcc/gcc/cp/parser.c:12654

$ xgcc --version
xgcc (GCC) 8.0.1 20180301 (experimental)

Built from git c435a9e730c6e8f10da09d58b4fc9aaeb401b0d5 (r258097).

It seems to have been introduced between 5.1 and 5.2.

Test case was minimised by C-Reduce.

Reply via email to