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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
One option would be to check whether libstdc++.so itself was built with
assertions enabled (which is true for the system compiler on many linux
distros), and then we could still use the explicit instantiations at -O0. If
the explicit instantiations are known to use assertions, then there's no reason
to not use them.

But that fails if you compile with the system gcc which has assertions in
libstdc++.so and then use a newer self-built libstdc++.so at runtime, and it
doesn't have the assertions in the library. When compiling the headers we'd
assume the explicit instantiations have assertions and so use the explicit
instantiations, but at runtime the definitions found by the dynamic linker
would not have the assertions.

Reply via email to