aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/expr/anew2.C
blob: b8681897577b0cf5113a23f1166a38306393b0b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// { dg-do run }
// PR 11228: array operator new, with zero-initialization and a variable sized array.
// Regression test for PR 
// Author: Matt Austern <austern@apple.com>


double* allocate(int n)
{
  return new double[n]();
}

int main()
{
  const int n = 17;
  double* p = allocate(n);
  for (int i = 0; i < n; ++i)
    if (p[i] != 0.0)
      return 1;
  return 0;
}