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

            Bug ID: 119446
           Summary: ICE in finish_member_declaration, at
                    cp/semantics.cc:4235
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: ice-checking, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rush102333 at gmail dot com
  Target Milestone: ---

Simplified test input:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

struct Base {
  virtual void func();
};

template <typename T>
struct wrapper {
    struct : Base {     
    };
};

void uses() {
    wrapper<int> w;
}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Stack Dump:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

<source>:7:12: error: anonymous struct with base classes [-Wtemplate-body]
    7 |     struct : Base {
      |            ^
<source>: In instantiation of 'struct wrapper<int>':
<source>:12:18:   required from here
   12 |     wrapper<int> w;
      |                  ^
<source>:7:5: internal compiler error: in finish_member_declaration, at
cp/semantics.cc:4235
    7 |     struct : Base {
      |     ^~~~~~
0x291f785 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x2936756 internal_error(char const*, ...)
        ???:0
0xacfde6 fancy_abort(char const*, int, char const*)
        ???:0
0xd55247 instantiate_class_template(tree_node*)
        ???:0
0xb997c2 start_decl_1(tree_node*, bool)
        ???:0
0xbb9ddf start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
        ???:0
0xcf21b3 c_parse_file()
        ???:0
0xe545f9 c_common_parse_file()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Please see https://godbolt.org/z/3sc8zzz1Y

Reply via email to