diff options
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/tm/noexcept-2.C')
-rw-r--r-- | gcc-4.9/gcc/testsuite/g++.dg/tm/noexcept-2.C | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tm/noexcept-2.C b/gcc-4.9/gcc/testsuite/g++.dg/tm/noexcept-2.C new file mode 100644 index 000000000..d2282489e --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/tm/noexcept-2.C @@ -0,0 +1,20 @@ +// { dg-do compile { target c++11 } } +// { dg-options "-fgnu-tm" } + +// All of these must fail, because they are not constant expressions. +template<typename T> int foo(int x, T t) +{ + __transaction_atomic noexcept(t) { x++; } /* { dg-error "not a constant" } */ + return __transaction_atomic noexcept(t) (x+1); /* { dg-error "not a constant" } */ +} + +int bar(int x) +{ + __transaction_atomic noexcept(x == 23) { x++; } /* { dg-error "not a constant" } */ + return __transaction_atomic noexcept(x == 42) (x+1); /* { dg-error "not a constant" } */ +} + +int f(int x) +{ + return foo<bool>(x, true); +} |