https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93971
--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> --- Using std::string as a dynamically-resizable buffer of bytes isn't completely unreasonable, although I can't see many reasons to prefer std::string to std::vector for that purpose. For either type, it might already be undefined because the placement new would begin the lifetime of a new object at that location, leading to undefined behaviour when the container destroys its elements, because there are no longer active char objects there (even if such destruction is trivial and doesn't actually execute any code). On the other hand, it could be argued that it's fine as long as the user recreates chars there before the container is resized/deallocated. So the compiler has to allow the placement new if it can't prove the user never restores objects of the right type. Yuck. I think asking LWG to decide whether we want to outlaw that for std::string would make sense.