| 1 |
// Verify we check new-expressions ahead of time. |
| 2 |
|
| 3 |
struct A { }; |
| 4 |
struct B { B(int); }; |
| 5 |
struct C { void* operator new(__SIZE_TYPE__, int); }; |
| 6 |
|
| 7 |
template<class T> |
| 8 |
void f() { |
| 9 |
new A(1); // { dg-error "no match" "" { xfail *-*-* } } |
| 10 |
new B(1, 2); // { dg-error "no match" } |
| 11 |
new B; // { dg-error "no match" } |
| 12 |
new C; // { dg-error "no match" } |
| 13 |
} |
| 14 |
|
| 15 |
|
| 16 |
template<class T> |
| 17 |
void g() { |
| 18 |
new int[__SIZE_MAX__]; // { dg-error "exceeds maximum" } |
| 19 |
new int[__SIZE_MAX__ / sizeof(int)]; // { dg-error "exceeds maximum" } |
| 20 |
} |