https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110057
--- Comment #19 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to user202729 from comment #18) > (In reply to Jonathan Wakely from comment #17) > The clause seems to apply just as well, you cannot access the newly > constructed `Derived` object through `p`. That's easily solved by accessing the new object through the pointer returned by the new expression: std::vector<Base> v(1); Base* p = v.data(); p->~Base(); p = ::new((void*)p) Derived(); p->f(); p->~Base(); ::new((void*)p) Base(); By the time anything is accessed through the vector's internal pointers, an object of the original type has been restored at that location, which meets all the requirements of [basic.life] p7. But that means v[0].f() wouldn't be valid, only p->f(), so adding information about the dynamic type to vector::operator[] would be allowed.