https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94810
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- Why can't you just use a global object with a constructor and destructor? That would get correctly ordered with respect to the std::ios_base::Init object that needs to be created before std::cout can be used. The constructor and destructor attributes not necessary in C++, and are documented as having an unspecified order relative to global objects (like the std::ios_base::Init one).