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