| 1 |
// { dg-do compile { target { external_musttail && c++11 } } } |
| 2 |
// { dg-options "-O2 -fexceptions" } |
| 3 |
|
| 4 |
struct S { ~S (); }; |
| 5 |
volatile int v; |
| 6 |
struct T { ~T () { v = v + 1; } }; |
| 7 |
struct U { ~U () {} }; |
| 8 |
int foo (); |
| 9 |
|
| 10 |
int |
| 11 |
bar () noexcept |
| 12 |
{ |
| 13 |
[[gnu::musttail]] return foo (); // { dg-error "cannot tail-call: call may throw exception that does not propagate" } |
| 14 |
} |
| 15 |
|
| 16 |
int |
| 17 |
baz () |
| 18 |
{ |
| 19 |
S s; |
| 20 |
[[gnu::musttail]] return foo (); // { dg-error "cannot tail-call: other reasons" } |
| 21 |
} |
| 22 |
|
| 23 |
int |
| 24 |
qux () |
| 25 |
{ |
| 26 |
T t; |
| 27 |
[[gnu::musttail]] return foo (); // { dg-error "cannot tail-call: other reasons" } |
| 28 |
} |
| 29 |
|
| 30 |
int |
| 31 |
corge () |
| 32 |
{ |
| 33 |
U u; |
| 34 |
[[gnu::musttail]] return foo (); |
| 35 |
} |