| 1 |
// { dg-do compile { target c++2a } } |
| 2 |
|
| 3 |
constexpr void |
| 4 |
cleanup (int *x) |
| 5 |
{ |
| 6 |
if (x) |
| 7 |
asm (""); // { dg-error "inline assembly is not a constant expression" } |
| 8 |
} // { dg-message "only unevaluated inline assembly is allowed in a 'constexpr' function" "" { target *-*-* } .-1 } |
| 9 |
|
| 10 |
constexpr void |
| 11 |
cleanup2 (int *x) |
| 12 |
{ |
| 13 |
} |
| 14 |
|
| 15 |
constexpr bool |
| 16 |
foo () |
| 17 |
{ |
| 18 |
int a __attribute__((cleanup (cleanup))) = 1; |
| 19 |
return true; |
| 20 |
} // { dg-message "in 'constexpr' expansion of" } |
| 21 |
|
| 22 |
constexpr bool |
| 23 |
bar () |
| 24 |
{ |
| 25 |
int a __attribute__((cleanup (cleanup2))) = 1; |
| 26 |
return true; |
| 27 |
} |
| 28 |
|
| 29 |
constexpr auto x = foo (); // { dg-message "in 'constexpr' expansion of" } |
| 30 |
constexpr auto y = bar (); |