| 1 |
// { dg-do compile } |
| 2 |
// { dg-additional-options "-std=c++14 -Wno-deprecated" } |
| 3 |
// C++17 does not allow dynamic exception specification. |
| 4 |
|
| 5 |
namespace a { |
| 6 |
int b; |
| 7 |
class c |
| 8 |
{ |
| 9 |
}; |
| 10 |
} |
| 11 |
class g |
| 12 |
{ |
| 13 |
public: |
| 14 |
g (); |
| 15 |
}; |
| 16 |
using a::b; |
| 17 |
class d |
| 18 |
{ |
| 19 |
public: |
| 20 |
d (); |
| 21 |
void e (); |
| 22 |
}; |
| 23 |
class f |
| 24 |
{ |
| 25 |
d |
| 26 |
i () |
| 27 |
{ |
| 28 |
static d j; |
| 29 |
return d(); |
| 30 |
} |
| 31 |
int *k () throw (a::c); |
| 32 |
}; |
| 33 |
|
| 34 |
|
| 35 |
int *f::k () throw (a::c) |
| 36 |
{ |
| 37 |
static g h; |
| 38 |
i (); |
| 39 |
int l = 2; |
| 40 |
while (l) |
| 41 |
{ |
| 42 |
--l; |
| 43 |
try |
| 44 |
{ |
| 45 |
operator new (b); |
| 46 |
} |
| 47 |
catch (a::c) |
| 48 |
{ |
| 49 |
} |
| 50 |
} |
| 51 |
i ().e (); |
| 52 |
return 0; |
| 53 |
} |