aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/init/new47.C
blob: acd52d7993bf193a53600a83525354cf2253a534 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// PR c++/70448
// { dg-do compile }
// { dg-options "-Wall" }

typedef __typeof__ (sizeof 0) size_t;
void *operator new (size_t, void *p) { return p; }
void *operator new[] (size_t, void *p) { return p; }
struct S { size_t s; };
void bar (S *);

void
foo (unsigned int s)
{
  char t[sizeof (S) + s];
  S *f = new (t) S;
  bar (f);
  f = new (t) S[1];
  bar (f);
}