aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/template/new11.C
blob: 76f6c66997f5ba14511e4a09a6144e39eba6aa94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// PR c++/54984
// { dg-do run }

int n = 1;

void* operator new(__SIZE_TYPE__)
{
  n = -1;
  return &n;
}

template <class T>
struct Foo
{
  Foo()
  : x(new int)
  {
    if (*x != -1)
      __builtin_abort();
  }

  int* x;
};

int main()
{
  Foo<float> foo;
}