Merged revisions 208012,208018-208019,208021,208023-208030,208033,208037,208040-20804...
[official-gcc.git] / main / gcc / testsuite / g++.dg / tm / noexcept-3.C
blob973b442cebcda618c920847df6ef5c9a494c331f
1 // { dg-do compile { target c++11 } }
2 // { dg-options "-fgnu-tm -O -fdump-tree-tmmark -fdump-tree-tmlower" }
4 // Same as noexcept-1.C but all noexcepts are false.
6 struct TrueFalse
8   static constexpr bool v() { return false; }
9 };
11 int global;
13 template<typename T> int foo()
15   __transaction_atomic noexcept(T::v()) { global += 1; }
16   return __transaction_atomic noexcept(T::v()) (global + 2);
19 int f1()
21   return foo<TrueFalse>();
24 int f2()
26   return __transaction_atomic noexcept(false) (global + 3)
27          + __transaction_atomic noexcept(TrueFalse::v()) (global + 4);
30 int f3()
32   __transaction_atomic noexcept(false) { global += 5; }
33   __transaction_atomic noexcept(TrueFalse::v()) { global += 6; }
34   return global;
37 /* { dg-final { scan-tree-dump-times "eh_must_not_throw" 0 "tmlower" } } */
38 /* { dg-final { scan-tree-dump-times "ITM_RU" 6 "tmmark" } } */
39 /* { dg-final { cleanup-tree-dump "tmmark" } } */
40 /* { dg-final { cleanup-tree-dump "tmlower" } } */