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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Bjørnar Snoksrud from comment #3)
> Using '--std=c++20 -Os' generates minimal code.

That disables the explicit template instantiation declarations for std::string,
so the compiler performs implicit instantiations and then inlines the code.

Without C++20 the compiler sees the explicit instantiation declarations (i.e.
the 'extern template' declarations) and emits calls to those external
definitions, without inlining anything.

I think GCC needs to be better at deciding when to ignore the explicit
instantiations and to do implicit instantiations anyway.

Reply via email to