PR go/81893
[official-gcc.git] / libitm / testsuite / libitm.c++ / eh-4.C
blob68275e99706d5d0add7fce575fdbb1b9449f55ab
1 // Test that throwing out of an atomic_commit block commits the transaction.
3 // { dg-do run }
4 // { dg-options "-fgnu-tm" }
6 int main()
8   static int i;
9   bool caught = false;
10   try {
11     atomic_commit {
12       i = 12;
13       throw 42;
14       i = 24;
15     }
16   } catch (int x) {
17     caught = (x == 42);
18   }
19   if (!caught || i != 12)
20     __builtin_abort();