https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80899
Jason Merrill <jason at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu.org --- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> --- (In reply to Jan Hubicka from comment #4) > Is this valid C++? bar.mem is non-POD and is already constructed and it > seems fishy to placement new it to something different. It's very fishy; the code should use aligned_storage rather a different non-trivial type. My old proposed resolution for wg21.link/cwg1116 would have clarified that this is undefined, and might still happen to resolve wg21.link/cwg1027 , but it hasn't been accepted yet. On the other hand, it is careful to use the pointer returned from placement new rather than a pointer derived from mem, and it seems like we ought to use the information from placement new to guide devirtualization. So...sketchy code in a volatile area of semantics, but it seems like we could get it right without breaking important optimizations.