https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107852
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> --- As Martin S. suggested a few times, it would be nice if we had an attribute or something that could say that no members of 'this' are clobbered like that. It would be UB for the vector's allocator (whether it's using operator new or malloc or something else) to re-enter any of the vector's member functions while in the middle of resizing it. Or maybe some kind of pragma that says that for the duration of the current scope, the 'this' pointer should be assumed to be unreachable to global functions (such as operator new). Something like "#pragma GCC unescape(this)"