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; }