This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/84348] New: [7/8 Regression] ICE with invalid friend declaration


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

            Bug ID: 84348
           Summary: [7/8 Regression] ICE with invalid friend declaration
           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
  Target Milestone: ---

The followong invalid code snippet triggers an ICE since GCC 7.1.0:

========================================
template<typename> struct A
{
  friend auto foo;
};
========================================

bug.cc:3:15: error: 'foo' is neither function nor member function; cannot be
declared friend
   friend auto foo;
               ^~~
bug.cc:3:15: internal compiler error: in cp_finish_decl, at cp/decl.c:6806
0x6000c1 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ../../gcc/gcc/cp/decl.c:6806
0x8b0037 grokfield(cp_declarator const*, cp_decl_specifier_seq*, tree_node*,
bool, tree_node*, tree_node*)
        ../../gcc/gcc/cp/decl2.c:1002
0x9260ee cp_parser_member_declaration
        ../../gcc/gcc/cp/parser.c:23871
0x92707a cp_parser_member_specification_opt
        ../../gcc/gcc/cp/parser.c:23345
0x92707a cp_parser_class_specifier_1
        ../../gcc/gcc/cp/parser.c:22487
0x9290d9 cp_parser_class_specifier
        ../../gcc/gcc/cp/parser.c:22739
0x9290d9 cp_parser_type_specifier
        ../../gcc/gcc/cp/parser.c:16745
0x936266 cp_parser_decl_specifier_seq
        ../../gcc/gcc/cp/parser.c:13606
0x93a9a5 cp_parser_single_declaration
        ../../gcc/gcc/cp/parser.c:27051
0x93ad2c cp_parser_template_declaration_after_parameters
        ../../gcc/gcc/cp/parser.c:26743
0x93b5ec cp_parser_explicit_template_declaration
        ../../gcc/gcc/cp/parser.c:26980
0x93b5ec cp_parser_template_declaration_after_export
        ../../gcc/gcc/cp/parser.c:26999
0x940959 cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:12710
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.]

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]