Debian Codegraph @

libitm/testsuite/libitm.c++/eh-4.C

raw
1 // Test that throwing out of an atomic_commit block commits the transaction.
2
3 // { dg-do run }
4 // { dg-options "-fgnu-tm" }
5
6 int main()
7 {
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();
21 }