Merge from mainline
[official-gcc.git] / gcc / testsuite / g++.dg / opt / pr25005.C
blobf62f8a2bcee59a7e28a8470c5cbbc8a1420ab898
1 // PR target/25005
2 // { dg-options "-O2 -funroll-loops" }
3 // { dg-do compile }
5 inline void *operator new (__SIZE_TYPE__, void *__p) throw() { return __p; }
7 struct M { ~M() { } };
9 struct P
11   P () { v[0] = 0; v[1] = 0; v[2] = 0; }
12   P (const P &x) { for (int i = 0; i < 3; ++i) v[i] = x.v[i]; }
13   double v[3];
16 struct V : public M
18   V (const P *x, const P *y)
19   {
20     P *b = this->a = ::new P[2];
21     for (; x != y; ++x, ++b)
22       ::new (b) P(*x);
23   }
24   P *a;
27 void bar (const V &);
29 void
30 foo ()
32   const P d[2] = { P(), P() };
33   bar (V (&d[0], &d[2]));