summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/init/new24.C
blob: 6f5613be7f6a26c21f0f939cf82b4968f8eceaf4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// PR c++/33025
// { dg-do compile }
// { dg-options "-O2" }

typedef __SIZE_TYPE__ size_t;
inline void *operator new (size_t, void *p) throw () { return p; }
extern "C" void abort ();

int
main()
{
  const unsigned num = 10;
  unsigned *data = new unsigned[num];
  unsigned *ptr = new (data) unsigned (num);
  static unsigned data2[10];
  unsigned *ptr2 = new (&data2[0]) unsigned (10);
  return 0;
}