Elektrine lite

← Feed

@shafik@hachyderm.io

Post #2037221

2026-04-29 02:36 UTC

#313 Given the following in C++ static union { int x; }; // Well-formed? Without checking: A. Yes B. No #Cplusplus #Cpppolls

Replies (1)

  • @shafik@hachyderm.io 2026-05-05 17:15

    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"

    Open ##2037220