[Bug c++/86581] constexpr variable allows uninitialized member of anonymous struct inside union
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86581 Andrew Pinski changed: What|Removed |Added Keywords||diagnostic --- Comment #3 from Andrew Pinski --- GCC 10+ rejects it but does NOT say why though: :6:13: error: 'V{V::{V{0}}}' is not a constant expression 6 | constexpr V v; | So keeping open for that. (In reply to Ted Lyngmo from comment #2) > Does this bug cover this case? This compiles with g++ but clang++ gives > "error: constexpr union constructor does not initialize any member". No.
[Bug c++/86581] constexpr variable allows uninitialized member of anonymous struct inside union
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86581 Ted Lyngmo changed: What|Removed |Added CC||ted at lyncon dot se --- Comment #2 from Ted Lyngmo --- Does this bug cover this case? This compiles with g++ but clang++ gives "error: constexpr union constructor does not initialize any member". template union test { constexpr test() noexcept {} T member; }; int main() { test a; }