https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107500

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
You can't use placement new in a constexpr constructor, so it can't be
constinit, which means it is susceptible to the static initialization order
fiasco. init priority attributes are also a hack, and less portable.

The whole point of this is to ensure the global is accessible *before* any user
code runs, and still accessible *after* static destructors run. Saving a few
bytes is less important than correctness.

If you really need to avoid it, you can provide a dummy atexit that doesn't
register the destructor, or wait for a possible compiler improvement to
optimize it away. I'm not going to change libstdc++ to stop doing this.

Reply via email to