OSDN Git Service

/cp
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / template / new11.C
1 // PR c++/54984
2 // { dg-do run }
3
4 int n = 1;
5
6 void* operator new(__SIZE_TYPE__)
7 {
8   n = -1;
9   return &n;
10 }
11
12 template <class T>
13 struct Foo
14 {
15   Foo()
16   : x(new int)
17   {
18     if (*x != -1)
19       __builtin_abort();
20   }
21
22   int* x;
23 };
24
25 int main()
26 {
27   Foo<float> foo;
28 }