2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.dg / expr / anew3.C
blob3223546d4c8da8f780f76b3a964c847e8aa7c04b
1 // { dg-do run }
2 // PR 11228: array operator new, with zero-initialization and a variable sized array.
3 // Regression test for PR 
4 // Author: Matt Austern <austern@apple.com>
6 struct X
8   int a;
9   double b;
12 X* allocate(int n)
14   return new X[n]();
17 int main()
19   const int n = 17;
20   X* p = allocate(n);
21   for (int i = 0; i < n; ++i)
22     if (p[i].a != 0 || p[i].b != 0.0)
23       return 1;
24   return 0;