On 04/10/2017 01:50 PM, Richard Biener wrote: > +void *operator new(__SIZE_TYPE__, void *p2) { return p2; } > +struct B { B(int i_) : i(i_) {} int i; }; > +struct X > +{ > + unsigned char buf[sizeof (B)]; > +};
Pedantically, shouldn't there be something here to enforce X's alignment to be at least the same as B's ? > + > +int __attribute__((noinline)) foo() > +{ > + X x, y; > + new (&x) B (0); Thanks, Pedro Alves