1 /* { dg-do compile } */ 2 /* { dg-options "-O2 -Wstrict-aliasing" } */ 3 new(__SIZE_TYPE__,void * __p)4inline void *operator new (__SIZE_TYPE__, void *__p) throw() { return __p; } 5 6 struct Y { YY7 Y() {} 8 int i; 9 }; 10 11 struct X { XX12 X() {} constructX13 void construct(const Y& y) 14 { 15 new (&m_data[0]) Y(y); 16 } 17 bool initialized; 18 char m_data[sizeof (Y)]; 19 }; 20 21 void bar(const X&); foo(Y & y)22void foo(Y& y) 23 { 24 X x; 25 x.construct(y); 26 x.initialized = true; 27 bar(x); 28 } 29 30