https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108645
--- Comment #5 from Jonathan Wakely ---
(In reply to Jonathan Wakely from comment #3)
> In your example, all your strings fit in the SSO buffer inside the
> std::string object, so the LHS has sufficient capacity for the result.
Actually that's
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108645
--- Comment #4 from Jonathan Wakely ---
(In reply to Jonathan Wakely from comment #3)
> const auto __size = __lhs.size() + __rhs.size();
> if (__size > __lhs.capacity() && __size <= __rhs.capacity())
> return
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108645
--- Comment #3 from Jonathan Wakely ---
(In reply to Evan Teran from comment #1)
> Which results in the same behavior, so it appears to be that the:
>
> ```
> basic_string operator+(basic_string &&, basic_string &&)
> ```
>
> Overload doesn't
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108645
--- Comment #2 from Andrew Pinski ---
>Tested with both clang and gcc trunk, so it seems to be a library level issue.
I tested clang with -stdlib=libc++ and it produces the same results as without
that option (which is it uses gcc's
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108645
--- Comment #1 from Evan Teran ---
To further experiment, i factored out `std::accumulate`:
```
#include
#include
#include
#include
void print_v(const char *rem, const std::vector ) {
std::cout << rem;
for (const