Started between 20201018 and 20201108 : (derived from initlist-deduce3.C) $ cat z1.cc using size_t = decltype(sizeof 0); namespace std { template<typename T> union initializer_list { const T *ptr; size_t n; }; } template<typename T> void Task() {} auto b = { &Task<int> }; $ g++-12-20210919 -c z1.cc z1.cc:10:24: internal compiler error: in output_constructor_regular_field, at varasm.c:5514 10 | auto b = { &Task<int> }; | ^ 0x1025b84 output_constructor_regular_field ../../gcc/varasm.c:5514 0x1025b84 output_constructor ../../gcc/varasm.c:5826 0x1025ecf output_constant ../../gcc/varasm.c:5172 0x1025ecf assemble_variable_contents ../../gcc/varasm.c:2235 0x102dcad assemble_variable(tree_node*, int, int, int) ../../gcc/varasm.c:2414 0x102ffaa varpool_node::assemble_decl() ../../gcc/varpool.c:595 0x96ac1f output_in_order ../../gcc/cgraphunit.c:2135 0x96ac1f symbol_table::compile() ../../gcc/cgraphunit.c:2353 0x96d54f symbol_table::compile() ../../gcc/cgraphunit.c:2540 0x96d54f symbol_table::finalize_compilation_unit() ../../gcc/cgraphunit.c:2537
Confirmed. Note clang also ICEs :).
Started with r11-4547-g6fb7e3c29188ab7c.
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>: https://gcc.gnu.org/g:b1a8b92f8f78536a00012e2e53a0d12ddbe6836d commit r12-6951-gb1a8b92f8f78536a00012e2e53a0d12ddbe6836d Author: Marek Polacek <polacek@redhat.com> Date: Fri Jan 28 20:01:06 2022 -0500 c++: Reject union std::initializer_list [PR102434] Weird things are going to happen if you define your std::initializer_list as a union. In this case, we crash in output_constructor_regular_field. Let's not allow such a definition in the first place. PR c++/102434 gcc/cp/ChangeLog: * class.cc (finish_struct): Don't allow union initializer_list. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/initlist128.C: New test.
Fixed.