https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119109
--- Comment #7 from Stian Halseth <stian at itx dot no> ---
Marek, Jason: would you prefer a change to the test (below), or is this
something the C++ front end should handle, by not making the copy
during constant evaluation?
The original case from PR110822 compiles fine on sparc64:
constexpr std::string text = "Some text here"s;
std::string has a non-trivial copy constructor, so it is returned in
memory and the typeck.cc copy doesn't happen. Only the reduced
basic_string in the test is trivially copyable.
Giving it a copy constructor like the real one makes the test pass on
sparc64 for -std=c++11 through c++26:
constexpr basic_string(const basic_string &) : _M_p(_M_local_buf) {}