Fix test-suite fallout of default -Wreturn-type.
[official-gcc.git] / gcc / testsuite / g++.dg / warn / Wstrict-aliasing-bogus-placement-new.C
blob514957bcde2f87a63ade75b444525322932f372d
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -Wstrict-aliasing" } */
4 inline void *operator new (__SIZE_TYPE__, void *__p) throw() { return __p; }
6 struct Y {
7   Y() {}
8   int i;
9 };
11 struct X {
12   X() {}
13   void construct(const Y& y)
14   {
15     new (&m_data[0]) Y(y);
16   }
17   bool initialized;
18   char m_data[sizeof (Y)];
21 void bar(const X&);
22 void foo(Y& y)
24   X x;
25   x.construct(y);
26   x.initialized = true;
27   bar(x);