The destruction of default_widget
triggers UB if it happens to be ordered after the destruction of private_constant
. Such an ordering is permitted because the two objects are in different translation units and because "if an object is initialized statically, the object is destroyed in the same order as if the object was dynamically initialized" ([basic.start.term]/3
). I submit that std::exit()
shouldn't destroy trivially-destructable static-storage objects at all, or at least not clearly-innocuous objects like constexpr integral variables in namespace scope.