| 1 |
// { dg-do compile { target c++11 } } |
| 2 |
// { dg-options "-fgnu-tm -O -fdump-tree-tmmark -fdump-tree-tmlower" } |
| 3 |
|
| 4 |
// Similar to noexcept-1.C but without an explicit (true) for noexcept. |
| 5 |
|
| 6 |
struct TrueFalse |
| 7 |
{ |
| 8 |
static constexpr bool v() { return true; } |
| 9 |
}; |
| 10 |
|
| 11 |
int global; |
| 12 |
|
| 13 |
template<typename T> int foo() |
| 14 |
{ |
| 15 |
__transaction_atomic noexcept { global += 1; } |
| 16 |
return __transaction_atomic noexcept (global + 2) |
| 17 |
+ __transaction_atomic noexcept (global + 3); |
| 18 |
} |
| 19 |
|
| 20 |
int f1() |
| 21 |
{ |
| 22 |
return foo<TrueFalse>(); |
| 23 |
} |
| 24 |
|
| 25 |
int f3() |
| 26 |
{ |
| 27 |
__transaction_atomic noexcept { global += 4; } |
| 28 |
return __transaction_atomic noexcept (global + 5) |
| 29 |
+ __transaction_atomic noexcept (global + 6); |
| 30 |
} |
| 31 |
|
| 32 |
/* { dg-final { scan-tree-dump-times "eh_must_not_throw" 12 "tmlower" } } */ |
| 33 |
/* { dg-final { scan-tree-dump-times "ITM_RU" 6 "tmmark" } } */ |