https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99789
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Bugzilla is for reporting bugs, not for general programming advices. There is no bug here, the C++ standard for 64-bit architectures with its requirements on std::string_view etc. effectively mandates that the class stores a pointer and size which better should be also size_t and not something narrower. And you or your users made a choice of some ABI where passing this by value means it is not passed in registers.