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

            Bug ID: 84691
           Summary: internal compiler error: in poplevel_class, at
                    cp/name-lookup.c:4430
           Product: gcc
           Version: 8.0.1
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vegard.nossum at gmail dot com
                CC: webrown.cpp at gmail dot com
  Target Milestone: ---

Input:

template<typename>
struct a {
  unsigned b = [] {
    union {
      friend void c() {}
    };
  };
};

Output:

$ xgcc -x c++ -S -
<stdin>: In lambda function:
<stdin>:5:21: error: can't define friend function 'c' in a local class
definition
<stdin>: At global scope:
<stdin>:5:24: internal compiler error: in poplevel_class, at
cp/name-lookup.c:4430
0xe1ebc7 poplevel_class()
        /home/vegard/git/gcc/gcc/cp/name-lookup.c:4430
0x9ccaa8 popclass()
        /home/vegard/git/gcc/gcc/cp/class.c:7419
0x9ccaa8 pop_nested_class()
        /home/vegard/git/gcc/gcc/cp/class.c:7573
0xbd1380 finish_function(bool)
        /home/vegard/git/gcc/gcc/cp/decl.c:15864
0xf9fa39 cp_parser_function_definition_after_declarator
        /home/vegard/git/gcc/gcc/cp/parser.c:26812
0xfa1cbc cp_parser_late_parsing_for_member
        /home/vegard/git/gcc/gcc/cp/parser.c:27690
0xf1aed5 cp_parser_class_specifier_1
        /home/vegard/git/gcc/gcc/cp/parser.c:22733
0xf2642b cp_parser_class_specifier
        /home/vegard/git/gcc/gcc/cp/parser.c:22759
0xf2642b cp_parser_type_specifier
        /home/vegard/git/gcc/gcc/cp/parser.c:16765
0xf8be5a cp_parser_decl_specifier_seq
        /home/vegard/git/gcc/gcc/cp/parser.c:13627
0xfa7a20 cp_parser_simple_declaration
        /home/vegard/git/gcc/gcc/cp/parser.c:12936
0xfaf948 cp_parser_block_declaration
        /home/vegard/git/gcc/gcc/cp/parser.c:12881
0xfb1e14 cp_parser_declaration_statement
        /home/vegard/git/gcc/gcc/cp/parser.c:12474
0xefdd8b cp_parser_statement
        /home/vegard/git/gcc/gcc/cp/parser.c:10923
0xf0184b cp_parser_statement_seq_opt
        /home/vegard/git/gcc/gcc/cp/parser.c:11272
0xfd36d1 cp_parser_lambda_body
        /home/vegard/git/gcc/gcc/cp/parser.c:10683
0xfd36d1 cp_parser_lambda_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:10184
0xf38814 cp_parser_primary_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:5259
0xf7a2eb cp_parser_postfix_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:7028
0xf2e057 cp_parser_unary_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:8320

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

Built from git c435a9e730c6e8f10da09d58b4fc9aaeb401b0d5 (r258097).

Seems to have been introduced between 4.6.4 and 4.7.1.

Could be related to bug #84651?

Test case was minimised by C-Reduce.

Reply via email to