gcc/testsuite/g++.dg/cpp0x/initlist-eh1.C
raw| 1 | // { dg-do run { target c++11 } } |
| 2 | |
| 3 | #include <initializer_list> |
| 4 | |
| 5 | int as; |
| 6 | struct A { |
| 7 | A(const char *) { ++as; } |
| 8 | A(const A&) { ++as; } |
| 9 | ~A() { --as; } |
| 10 | }; |
| 11 | |
| 12 | void __attribute__((noipa)) |
| 13 | tata(std::initializer_list<A> init) |
| 14 | { |
| 15 | throw 1; |
| 16 | } |
| 17 | |
| 18 | int |
| 19 | main() |
| 20 | { |
| 21 | try { tata({ "foo","bar" }); } |
| 22 | catch (...) { } |
| 23 | |
| 24 | if (as != 0) __builtin_abort (); |
| 25 | } |