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.