Search code examples
c++c++11anonymous-typesunions

Why are global anonymous unions required to be declared as static?


C++ 0x draft

9.5.6 Anonymous unions declared in a named namespace or in the global namespace shall be declared static.

Why is this?


Solution

  • My guess is that if it were allowed to define the union in a non static way it may violate the ODR (one definition rule)