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

            Bug ID: 95972
           Summary: ICE in check_member_template, at cp/decl2.c:570
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: error-recovery, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: haoxintu at gmail dot com
  Target Milestone: ---

This code, bug.cc, reduced by C-Reduce, makes GCC-trunk ICE.

$cat bug.cc
a() { [] ( struct { b ( auto

$g++ -w bug.cc
bug.cc:1:1: error: ISO C++ forbids declaration of ‘a’ with no type
[]8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-fpermissive-fpermissive]8;;]
    1 | a() { [] ( struct { b ( auto
      | ^
bug.cc: In function ‘int a()’:
bug.cc:1:19: error: types may not be defined in parameter types
    1 | a() { [] ( struct { b ( auto
      |                   ^
bug.cc:2: error: expected ‘,’ or ‘...’ at end of input
bug.cc:1:29: error: expected ‘)’ at end of input
    1 | a() { [] ( struct { b ( auto
      |                       ~     ^
      |                             )
bug.cc:1:21: error: ISO C++ forbids declaration of ‘b’ with no type
[]8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-fpermissive-fpermissive]8;;]
    1 | a() { [] ( struct { b ( auto
      |                     ^
bug.cc:2: internal compiler error: in check_member_template, at cp/decl2.c:570
0x61d665 check_member_template(tree_node*)
        ../../gcc/cp/decl2.c:570
0x9d3490 finish_member_template_decl(tree_node*)
        ../../gcc/cp/pt.c:308
0x989fba finish_fully_implicit_template
        ../../gcc/cp/parser.c:44279
0x9cb99a cp_parser_member_declaration
        ../../gcc/cp/parser.c:25414
0x99f921 cp_parser_member_specification_opt
        ../../gcc/cp/parser.c:24850
0x99f921 cp_parser_class_specifier_1
        ../../gcc/cp/parser.c:23947
0x9a1aa3 cp_parser_class_specifier
        ../../gcc/cp/parser.c:24254
0x9a1aa3 cp_parser_type_specifier
        ../../gcc/cp/parser.c:17762
0x9a2a02 cp_parser_decl_specifier_seq
        ../../gcc/cp/parser.c:14410
0x9bf3ef cp_parser_parameter_declaration
        ../../gcc/cp/parser.c:22818
0x9bfdd2 cp_parser_parameter_declaration_list
        ../../gcc/cp/parser.c:22641
0x9c01bc cp_parser_parameter_declaration_clause
        ../../gcc/cp/parser.c:22568
0x9c0bae cp_parser_lambda_declarator_opt
        ../../gcc/cp/parser.c:11102
0x9a8836 cp_parser_lambda_expression
        ../../gcc/cp/parser.c:10633
0x9a8836 cp_parser_primary_expression
        ../../gcc/cp/parser.c:5443
0x9b2960 cp_parser_postfix_expression
        ../../gcc/cp/parser.c:7296
0x99564a cp_parser_binary_expression
        ../../gcc/cp/parser.c:9609
0x9971ae cp_parser_assignment_expression
        ../../gcc/cp/parser.c:9914
0x9974d2 cp_parser_expression
        ../../gcc/cp/parser.c:10082
0x99a368 cp_parser_expression_statement
        ../../gcc/cp/parser.c:11742
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

$g++ --version
g++ (GCC) 11.0.0 20200626 (experimental)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Reply via email to