https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26388
--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Martin Sebor from comment #10) > The implementation challenges aside, I think the transformation suggested > here could break some valid (if rare) C++ programs. std::vector is > specified to use std::allocator to obtain storage which in turn is specified > to use operator new. Eventually, but not for every allocation. I think if std::allocator did this optimisation there is no way a conforming program could tell the difference. Users can replace operator new (or malloc) but it's unspecified when or how often that would be called by std::allocator. Users can specialize std::allocator for their own types, so can observe calls to its allocate/deallocate members, but if the optimisation is done by the std::allocator primary template then it wouldn't happen for user specializations of std::allocator, so we're still OK.