gcc/testsuite/g++.dg/tm/unsafe1.C
raw| 1 | // Transaction-unsafe testcase from TM TS. |
| 2 | // { dg-options -fgnu-tm } |
| 3 | |
| 4 | struct S { |
| 5 | virtual ~S(); |
| 6 | }; |
| 7 | void f() transaction_safe { |
| 8 | S s; |
| 9 | } // { dg-error "unsafe" "invocation of unsafe destructor" } |
| 10 | |
| 11 | int g(int x) { // is transaction-safe |
| 12 | if (x <= 0) |
| 13 | return 0; |
| 14 | return x + g(x-1); |
| 15 | } |