| 1 |
// Test for throwing bad_array_new_length on invalid array length |
| 2 |
// { dg-do run { target c++11 } } |
| 3 |
|
| 4 |
#include <new> |
| 5 |
|
| 6 |
void * f(int i) |
| 7 |
{ |
| 8 |
return new int[i]; |
| 9 |
} |
| 10 |
|
| 11 |
int main() |
| 12 |
{ |
| 13 |
try |
| 14 |
{ |
| 15 |
f(-1); |
| 16 |
} |
| 17 |
catch (std::bad_array_new_length) { return 0; } |
| 18 |
__builtin_abort (); |
| 19 |
} |