https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105876
--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Kevin Hendricks from comment #3) > I thought the C++ spec said that static initialization is done in two > phases. global (extern cost) variable are always initialized in the order > they are declared first and local (dynamic) static initialization is always > done second (and order across compilation units is undefined as your say). No, that's not a correct description of what the standard says. You're mixing up two separate concepts (which isn't entirely surprising because the standard uses "static" to refer to too many different concepts). > By definition isn't a global variable available in all translation units. It can be referred to by name in all translation units, but that doesn't affect when it is initialized. Your extern const and your static const both have "static storage duration", which describes their lifetime, i.e. when they are initialized and destroyed. See https://en.cppreference.com/w/cpp/language/storage_duration#Storage_duration Their storage duration is orthogonal to whether the name is visible outside the current translation unit, which is determined by their linkage. See https://en.cppreference.com/w/cpp/language/storage_duration#Linkage