[Bug c++/126749] New: ICE in build_simple_base_path when initializing a static member of an incomplete derived class

"s.kimura.h41104 at gmail dot com via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126749

            Bug ID: 126749
           Summary: ICE in build_simple_base_path when initializing a
                    static member of an incomplete derived class
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: s.kimura.h41104 at gmail dot com
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/jox7nhexd

Reproducer:
```
struct S {
  int foo;
  S operator|(S) const;
};

struct SS : S {
  static const SS ss;
  static const SS bar = SS{ss | ss};
}
```

Backtrace:
<source>:8:33: error: cannot convert from 'SS' to base class 'S' because 'SS'
is incomplete
    8 |   static const SS bar = SS{ss | ss};
      |                                 ^~
<source>:8:33: internal compiler error: in build_simple_base_path, at
cp/class.cc:613
0x2b97f28 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x2b8cb6b internal_error(char const*, ...)
        ???:0
0xb40b7e fancy_abort(char const*, int, char const*)
        ???:0
0xb99c28 build_base_path(tree_code, tree_node*, tree_node*, int, int)
        ???:0
0xb628f3 build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
        ???:0
0xb63c4d build_special_member_call(tree_node*, tree_node*, vec<tree_node*,
va_gc, vl_embed>**, tree_node*, int, int)
        ???:0
0xb7d24a build_new_op(op_location_t const&, tree_code, int, tree_node*,
tree_node*, tree_node*, tree_node*, tree_node**, int)
        ???:0
0xe800c2 build_x_binary_op(op_location_t const&, tree_code, tree_node*,
tree_code, tree_node*, tree_code, tree_node*, tree_node**, int)
        ???:0
0xd96823 c_parse_file()
        ???:0
0xf29cf9 c_common_parse_file()
        ???:0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.