namespace std { typedef __SIZE_TYPE__ size_t; } inline void* operator new(std::size_t, void* __p) throw() { return __p; } extern "C" void abort (void); class Foo { public: virtual void test (void) { abort (); } }; class Bar { public: virtual void test (void) { } }; int main() { Foo f; Bar *b; b = new (&f) Bar(); b->test(); return 0; }
-- Summary: [4.6 Regression] Devirtualization results in wrong-code Product: gcc Version: 4.6.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rguenth at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45734