https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97665

--- Comment #5 from Luke Dalessandro <ldalessandro at gmail dot com> ---
Ugh... replying to myself.

> You can do Foo foo = Foo(); and it compiles.

>> 1. I can't do `Foo foo = Foo();` because the purpose of the union is to 
>> allocate uninitialized storage for the `Foo` during `constexpr` execution 
>> when `Foo` has no default constructor. I realize now I meant to write 
>> `constexpr Foo() = delete;`.

This means to say "trivial default constructor," not just "default
constructor". The empty default constructor was an adequate test case for this,
but is misleading. The `= delete` should be more effective as an example.

The context for the use is to create an array that provides uninitialized
vector storage during `constexpr` evaluation in the same way a
`std::byte[T*sizeof(T)]` array combined with `reinterptret_cast<T*>` might be
used during normal execution.

Reply via email to