SATURDAY, APRIL 18, 2026
libstdc++ — Impact 6 / 10
Libstdc++: Fix constantness of engaged -> disengaged std::optional.
Clearing a `std::optional` in C++23 now maintains constant expression requirements, fixing a compile-time error.
When a std::optional containing a value is cleared, the destructor of the contained value is invoked, potentially leaving the union without an active member during constant evaluation. This violates constant expression requirements, diagnosed by Clang and recent GCC versions. This patch activates a dummy union member after destroying the value to ensure the union always has an active member and uses std::construct_at to avoid a front-end bug.