[Bug lto/82172] Destruction of basic_string in basic_stringbuf::overflow with _GLIBCXX_USE_CXX11_ABI=0, -flto, and C++17 mode results in invalid delete

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Sep 22 14:04:00 GMT 2017


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

--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
N.B. this bug has been latent for years. The reason people are only seeing it
now is that usually the "extern template class std::basic_string<char>"
explicit instantiation declarations prevent this symbol being emitted in user's
object files, so the definition in the library is used.

When compiling with -std=c++17 that extern template is not declared, so the
compiler emits a definition of that symbol in every object that uses the old
std::string.


More information about the Gcc-bugs mailing list