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

            Bug ID: 84694
           Summary: internal compiler error: tree check: expected tree
                    that contains 'decl minimal' structure, have
                    'identifier_node' in do_friend, at cp/friend.c:498
           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 {
  template<a()> void b();
  friend b<>();
}

Output:

$ xgcc -x c++ -S - 
<stdin>:4:14: error: ISO C++ forbids declaration of 'b' with no type
[-fpermissive]
<stdin>:4:14: internal compiler error: tree check: expected tree that contains
'decl minimal' structure, have 'identifier_node' in do_friend, at
cp/friend.c:498
0x66106d tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
        /home/vegard/git/gcc/gcc/tree.c:9509
0xcefe59 contains_struct_check(tree_node*, tree_node_structure_enum, char
const*, int, char const*)
        /home/vegard/git/gcc/gcc/tree.h:3246
0xcefe59 do_friend(tree_node*, tree_node*, tree_node*, tree_node*,
overload_flags, bool)
        /home/vegard/git/gcc/gcc/cp/friend.c:498
0xc13c1d grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*,
decl_context, int, tree_node**)
        /home/vegard/git/gcc/gcc/cp/decl.c:12203
0xc5a1c9 grokfield(cp_declarator const*, cp_decl_specifier_seq*, tree_node*,
bool, tree_node*, tree_node*)
        /home/vegard/git/gcc/gcc/cp/decl2.c:829
0xfe26da cp_parser_member_declaration
        /home/vegard/git/gcc/gcc/cp/parser.c:23893
0xf1871b cp_parser_member_specification_opt
        /home/vegard/git/gcc/gcc/cp/parser.c:23372
0xf1871b cp_parser_class_specifier_1
        /home/vegard/git/gcc/gcc/cp/parser.c:22514
0xf2763b cp_parser_class_specifier
        /home/vegard/git/gcc/gcc/cp/parser.c:22766
0xf2763b cp_parser_type_specifier
        /home/vegard/git/gcc/gcc/cp/parser.c:16772
0xf8c7ba cp_parser_decl_specifier_seq
        /home/vegard/git/gcc/gcc/cp/parser.c:13627
0xfa6ddf cp_parser_single_declaration
        /home/vegard/git/gcc/gcc/cp/parser.c:27185
0xfc9658 cp_parser_template_declaration_after_parameters
        /home/vegard/git/gcc/gcc/cp/parser.c:26874
0xfc7c5b cp_parser_explicit_template_declaration
        /home/vegard/git/gcc/gcc/cp/parser.c:27112
0xfc7c5b cp_parser_template_declaration_after_export
        /home/vegard/git/gcc/gcc/cp/parser.c:27130
0x10029c1 cp_parser_declaration
        /home/vegard/git/gcc/gcc/cp/parser.c:12727
0xff9d9b cp_parser_declaration_seq_opt
        /home/vegard/git/gcc/gcc/cp/parser.c:12654
0xffb3c3 cp_parser_translation_unit
        /home/vegard/git/gcc/gcc/cp/parser.c:4561
0xffb3c3 c_parse_file()
        /home/vegard/git/gcc/gcc/cp/parser.c:38993
0x15a7105 c_common_parse_file()
        /home/vegard/git/gcc/gcc/c-family/c-opts.c:1132

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

Built from git 0d86c284d085d29782d862600a79aa1ff0ee0c47 (r258221).

7.3.0 says:

<source>:4:14: error: ISO C++ forbids declaration of 'b' with no type
[-fpermissive]
   friend b<>();
              ^
<source>:5:2: error: expected ';' after struct definition
 }
  ^
  ;
Compiler returned: 1

Test case was minimised by C-Reduce.

Reply via email to