This ensures that the objects returned by std::generic_category() and std::system_category() are initialized before any code starts executing, and are not destroyed at the end of the program. This means it is always safe to access them, even during startup and termination. See LWG 2992 and P1195R0 for further discussion of this. Additionally, make the types of those objects final, which might potentially allow additional devirtualization opportunities. The types are not visible to users, so there is no way they can derive from them, so making them final has no semantic change. Finally, add overrides for equivalent(int, const error_condition&) to those types, to avoid the second virtual call that would be performed by the base class definition of the function. Because we know what default_error_condition(int) does for the derived type, we don't need to make a virtual call. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * src/c++11/system_error.cc (generic_error_category): Define class and virtual functions as 'final'. (generic_error_category::equivalent(int, const error_condition&)): Override. (system_error_category): Define class and virtual functions as 'final'. (system_error_category::equivalent(int, const error_condition&)): Override. (generic_category_instance, system_category_instance): Use constinit union to make the objects immortal. Tested x86_64-linux. Committed to trunk.