summaryrefslogtreecommitdiffstats
path: root/gcc/testsuite/g++.dg/cpp0x/initlist53.C
blob: 22633f909559b98d2399a2f12a96c0ffaa68adbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// PR c++/49216
// { dg-options -std=c++0x }
// { dg-do run }

#include <initializer_list>
extern "C" void abort();
void * operator new[] (__SIZE_TYPE__, void *p) { return p; }

bool constructed;

struct A
{
  A(std::initializer_list<int>) { constructed = true; }
};

int main() {
  new A[1]{};
  int space[1] = { 42 };
  int *p = new (space) int[1]{};
  if (p[0] != 0 || !constructed)
    abort();
}
OpenPOWER on IntegriCloud