[Bug libstdc++/124396] Optimize compile times for internal uses of std::string
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Mar 7 12:39:11 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124396
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
For <string_view>, that is because std::__sv_check (used by
std::basic_string_view::{copy,substr}) and std::basic_string_view::at calls
__throw_out_of_range_fmt.
And those need to throw at constexpr time std::out_of_range objects.
And std::out_of_range is required by the standard to have constructor from
std::string.
But sure, if we have some subset of <string> that satisfies the uses in <meta>
and <stdexcept> and doesn't provide everything else, perhaps it could be
optimized.
More information about the Gcc-bugs
mailing list