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