https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117813
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu.org --- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Unsure, that commit has been pure extra optimization. I guess the problem here is extern template class __shared_ptr<filesystem::recursive_directory_iterator::_Dir_stack>; Without that it would be purely up to the compiler to choose whether to emit a C4 ctor or C1/C2 aliases, or C1 and C2 which calls C4, etc. But when the template is extern, that decision becomes part of the ABI (and libstdc++ in particular chooses to mostly emit both C1 and C2 (sometimes only one of them is exported and the other one added later), current trunk has C1 vs. C2 parity. And this isn't solely about libstdc++, guess one can use extern template in other codebases as well and supply the template instantiations.