This causes the global objects that run the <iostream> initialization
code to be constructed earlier, which avoids some bugs in user code due
to incorrectly relying on static initialization order.
libstdc++-v3/ChangeLog:
PR libstdc++/98108
* include/std/iostream (__ioinit): Add init_priority attribute.
#endif
//@}
+#if __has_attribute(__init_priority__)
+# define _GLIBCXX_INIT_PRIO(N) __attribute__((__init_priority__(N)))
+#else
+# define _GLIBCXX_INIT_PRIO(N)
+#endif
+
// For construction of filebuffers for cout, cin, cerr, clog et. al.
- static ios_base::Init __ioinit;
+ static ios_base::Init __ioinit _GLIBCXX_INIT_PRIO(90);
+
+#undef _GLIBCXX_INIT_PRIO
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace