On Mon, 10 Apr 2017, Pedro Alves wrote:
> 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);
Right. I'll do
X x alignas(B), y alignas(B);
Meanwhile need to debug a LTO bootstrap failure caused by the patch.
Richard.