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

            Bug ID: 84375
           Summary: [8 Regression] ICE with friend in local class
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Keywords: error-recovery, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org
                CC: nathan at gcc dot gnu.org
            Blocks: 12944
  Target Milestone: ---

The following invalid testcase triggers an ICE on trunk:

===========================
void foo()
{
  struct A
  {
    friend void A();
  };
}
===========================

bug.cc: In function 'void foo()':
bug.cc:5:19: error: friend declaration 'void A()' in local class without prior
local declaration
     friend void A();
                   ^
bug.cc:6:4: internal compiler error: in pop_local_binding, at
cp/name-lookup.c:2062
   };
    ^
0x61f401 pop_local_binding(tree_node*, tree_node*)
        ../../gcc/gcc/cp/name-lookup.c:2062
0x8962ad poplevel(int, int, int)
        ../../gcc/gcc/cp/decl.c:776
0x99e5c3 do_poplevel(tree_node*)
        ../../gcc/gcc/cp/semantics.c:451
0x9a0149 finish_compound_stmt(tree_node*)
        ../../gcc/gcc/cp/semantics.c:1450
0x91cd0f cp_parser_compound_statement
        ../../gcc/gcc/cp/parser.c:11211
0x933460 cp_parser_function_body
        ../../gcc/gcc/cp/parser.c:21747
0x933460 cp_parser_ctor_initializer_opt_and_function_body
        ../../gcc/gcc/cp/parser.c:21784
0x933d10 cp_parser_function_definition_after_declarator
        ../../gcc/gcc/cp/parser.c:26685
0x934a27 cp_parser_function_definition_from_specifiers_and_declarator
        ../../gcc/gcc/cp/parser.c:26601
0x934a27 cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:19473
0x93bac8 cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:13038
0x93c8d8 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:12863
0x940832 cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:12761
0x940c41 cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:12637
0x940f34 cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:4559
0x940f34 c_parse_file()
        ../../gcc/gcc/cp/parser.c:38857
0xa3f566 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1132
Please submit a full bug report, [etc.]

The regression was introduced between 2017-05-19 and 2017-05-25.
Nathan, this might be related to your name-lookup changes.
Would you mind having a look?


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=12944
[Bug 12944] [meta-bug] C++ name-lookup problems

Reply via email to