1// { dg-do run { xfail *-*-* } }
2// XFAILed until PR2123 is fixed
3// PR 11228: array operator new, with zero-initialization and a variable sized array.
4// Regression test for PR
5// Author: Matt Austern <austern@apple.com>
6
7
8#include <new>
9#include <stdlib.h>
10#include <string.h>
11
12double* allocate(int n)
13{
14  void *p;
15  p = malloc(n * sizeof (double));
16  memset (p, 0xff, n * sizeof(double));
17  return new (p) double[n]();
18}
19
20int main()
21{
22  const int n = 17;
23  double* p = allocate(n);
24  for (int i = 0; i < n; ++i)
25    if (p[i] != 0.0)
26      abort ();
27  exit (0);
28}
29