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

libstdc++: Adjust test expectations for trivial unions (P3074R7).

Updates libstdc++ tests to reflect that trivial unions are now trivially destructible under `__cpp_trivial_union >= 202502L`.

Several libstdc++ test cases have been adjusted to reflect changes introduced by P3074R7 regarding trivial unions. Specifically, the tests for is_constructible, is_destructible, and is_nothrow_destructible now expect a different value when compiling with C++26 or later (indicated by __cpp_trivial_union >= 202502L), as trivial unions are now considered trivially destructible.

In Details

This commit modifies testsuite files in libstdc++-v3 (specifically, testsuite/20_util/is_constructible/value-2.cc, testsuite/20_util/is_destructible/value.cc, and testsuite/20_util/is_nothrow_destructible/value.cc). These tests rely on the __cpp_trivial_union feature test macro. The change stems from P3074R7, which altered the triviality of union destruction.

For Context

The libstdc++ is the C++ standard library. Certain C++ features are guarded by feature-test macros, which are preprocessor symbols that indicate whether a particular feature is supported by the compiler. This commit updates the standard library's test suite to reflect a change in the behavior of trivial unions, as defined by the C++ standard. This change ensures that the library's tests accurately reflect the current state of the language.

Filed Under: libstdc++trivial unionsc++26testsuite