2026-05-05 17:15 UTC
Answer is A
Yes, this is valid, see [class.union.anon]p2: https://eel.is/c++draft/class.union.anon#2
"An anonymous union declared in the scope of a namespace with external linkage shall use the storage-class-specifier static"
Replies (2)
-
@alison@burningboard.net 2026-05-05 19:52
@shafik@hachyderm.io Presumably either the member or the union can be anonymous, but not both.
-
@lzon@mastodon.social 2026-05-06 06:32
@shafik@hachyderm.io I've been a C++ programmer since high school and I only learned about this a few weeks ago.