| 1 |
// { dg-do run { target c++11 } } |
| 2 |
struct A {}; |
| 3 |
struct B {}; |
| 4 |
struct C {}; |
| 5 |
|
| 6 |
template<typename... Exceptions> void f(int idx) |
| 7 |
#if __cplusplus <= 201402L |
| 8 |
throw(Exceptions...) // { dg-warning "deprecated" "" { target { ! c++17 } } } |
| 9 |
#endif |
| 10 |
{ |
| 11 |
if (idx == 0) throw A(); |
| 12 |
else if (idx == 1) throw B(); |
| 13 |
else if (idx == 2) throw C(); |
| 14 |
} |
| 15 |
|
| 16 |
extern "C" void abort(); |
| 17 |
|
| 18 |
int main() |
| 19 |
{ |
| 20 |
try { |
| 21 |
f<A, B, C>(0); |
| 22 |
abort(); |
| 23 |
} catch (A) { |
| 24 |
} |
| 25 |
try { |
| 26 |
f<A, B, C>(1); |
| 27 |
abort(); |
| 28 |
} catch (B) { |
| 29 |
} |
| 30 |
try { |
| 31 |
f<A, B, C>(2); |
| 32 |
abort(); |
| 33 |
} catch (C) { |
| 34 |
} |
| 35 |
return 0; |
| 36 |
} |