https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106233
Bug ID: 106233 Summary: Designated initializers targeting inherited fields breaks reshape_init_class, at cp/decl.c:6456 Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: drahflow at gmx dot de Target Milestone: --- In a vain attempt to use designated initializers to target inherited fields, I discovered that running g++ -W -Wall --std=c++20 ... on ... struct Base { int i; }; struct Derived: public Base { using Base::i; }; int main(void) { Derived d{ .i = 0, }; return d.i; } ... results in ... designated-usage.c++: In function ‘int main()’: designated-usage.c++:12:3: internal compiler error: in reshape_init_class, at cp/decl.c:6456 12 | }; | ^ 0x7f080f8137fc __libc_start_main ../csu/libc-start.c:332 Please submit a full bug report, [...] ... for ... g++ --version g++ (Debian 11.2.0-18) 11.2.0 Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. GCC 12.1 gives <source>: In function 'int main()': <source>:12:3: error: 'Base::i' is not a direct member of 'Derived' 12 | }; | ^ Compiler returned: 1 ... the correctness of which I don't feel qualified to judge.