https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87502
--- Comment #3 from Marc Glisse <glisse at gcc dot gnu.org> --- (In reply to M Welinder from comment #2) > The destruction still stinks: the full destructor is inlined instead of > the small-string-only version (i.e., a no-op). Evidently gcc cannot > see that the string remains a small-string. void foo (const std::string &s){ const_cast<std::string&>(s)="some longer string so it needs proper deletion"; }