GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
c++

C++: Fix build_value_init_noctor anon aggr handling

The C++ compiler now correctly initializes anonymous aggregates without default constructors, fixing a bootstrap failure.

This commit fixes a bootstrap failure in the C++ compiler related to the initialization of anonymous unions or structs that lack default constructors. The compiler now zero-initializes these anonymous aggregate members, resolving the issue that arose from attempting to call build_value_init on such types. This ensures correct initialization and allows the compiler to build successfully.

In Details

This commit modifies init.cc to handle anonymous aggregates (unions/structs) without default constructors in build_value_init_noctor. The original code attempted to call build_value_init on these types, leading to issues. Now, the code zero-initializes the anonymous aggregate members. This fixes a regression introduced by the CWG3130 patchset.

For Context

This commit addresses a problem in the C++ compiler that prevented it from properly initializing certain types of data structures called 'anonymous aggregates'. These are essentially data structures without a name that are embedded within other data structures. The fix ensures these anonymous aggregates are correctly initialized with zero values, resolving a bug that caused the compiler to fail during its own build process.

Filed Under: c++initializationanonymous aggregatebugfix