https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80944

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
Good point!  It never occurred to me.  That explains why no compiler does it.

That suggests that the optimization opportunity is up to the user.  I.e., a
class like std::string could optimize this case by adding a constraint/assert
that s->s doesn't point at s.  Let me look into that.

Reply via email to