There's a corner case for which the current specification of `std::string::append` will frequently lead to undefined behavior.
Consider something like:
```cpp
std::strings = "A long enough string that two copies of it probably won't fit into the currently allocated storage";
s.append(s);
```
Even more natural:
which is equivalent to
s.append(s)
which is equivalent to
s.append(s.data(), s.size())
> Appends a copy of the range [s, s + n) to the string.
However — it is not clear to me that this wording gives the implementation permission to append anything other than [s, s+n) to the string in the case that the appending operation itself causes [s, s+n) to become invalidated.
In fact, I've been here before:
Are you actually seeing some real-world `std::string` implementation misbehave? If so, I strongly recommend filing a bug with that vendor. They almost certainly already believe that they have to implement the behavior you expected, and so they'll treat it as a real bug (even if a hard-to-fix one).
Cheers,
Arthur