[Bug c++/67703] New: assert after placement new
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67703 Bug ID: 67703 Summary: assert after placement new Product: gcc Version: 5.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: piotrekpad at gmail dot com Target Milestone: --- Hi, This code is is c++11 valid: #include #include struct A { virtual void foo(); }; struct B : A{ void foo(); }; void f() { A *a = new A; a->foo(); A* b = new(&a) B; assert(a == b); b->foo(); new(b) A; a->foo(); } but when I compile it with g++ 5.1 or 5.2 it fails on assert (checked on https://gcc.godbolt.org/)
[Bug c++/67703] assert after placement new
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67703 Piotr Padlewski changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #2 from Piotr Padlewski --- Oh, you are right! Everything works, sorry