>[type punning via enum] No; this works in C (since C99...?), but in C++ "it is undefined behavior to read from the member of the union that wasn't most recently written.
it is technically UB, but it works as a documented extension on pretty much every compiler.