Debian Codegraph @

gcc/testsuite/g++.dg/tm/noexcept-2.C

raw
1 // { dg-do compile { target c++11 } }
2 // { dg-options "-fgnu-tm" }
3
4 // All of these must fail, because they are not constant expressions.
5 template<typename T> int foo(int x, T t)
6 {
7 __transaction_atomic noexcept(t) { x++; } /* { dg-error "not a constant" } */
8 return __transaction_atomic noexcept(t) (x+1); /* { dg-error "not a constant" } */
9 }
10
11 int bar(int x)
12 {
13 __transaction_atomic noexcept(x == 23) { x++; } /* { dg-error "not a constant" } */
14 return __transaction_atomic noexcept(x == 42) (x+1); /* { dg-error "not a constant" } */
15 }
16
17 int f(int x)
18 {
19 return foo<bool>(x, true);
20 }