https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101040
Bug ID: 101040 Summary: [11 Regression] Internal compiler error: in get_or_insert_ctor_field, at cp/constexpr.c:3571 Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: git at foonathan dot net Target Milestone: --- Minimal repro: https://godbolt.org/z/n71dhjPox ``` // This class has to be empty. struct empty {}; // This class has to be empty. struct single { // This member has to be no_unique_address. [[no_unique_address]] empty obj; }; // This class has to be empty and derived from single. struct derived : single { // This constructor has to be constexpr and take a forwarding reference. template <typename Arg> constexpr derived(Arg&& arg) : single{arg} {} }; auto obj = derived{empty{}}; ``` Fails on GCC 11.1 and trunk: ``` source>:21:27: in 'constexpr' expansion of 'derived(empty())' <source>:21:27: internal compiler error: in get_or_insert_ctor_field, at cp/constexpr.c:3571 21 | auto obj = derived{empty{}}; | ^ 0x1d322a9 internal_error(char const*, ...) ???:0 0x71fc09 fancy_abort(char const*, int, char const*) ???:0 0xa58de0 store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) ???:0 0x818a14 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int) ???:0 0x94812d c_parse_file() ???:0 0xacb002 c_common_parse_file() ???:0 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. Compiler returned: 1 ``` Works with GCC 10.3.