summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/tm/unsafe1.C
blob: 91dd7b110ecf8c98da2d9a3c792508ce502b77e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Transaction-unsafe testcase from TM TS.
// { dg-options -fgnu-tm }

struct S {
  virtual ~S();
};
int f() transaction_safe {
  S s;		     // { dg-error "unsafe" "invocation of unsafe destructor" }
}

int g(int x) { // is transaction-safe
  if (x <= 0)
    return 0;
  return x + g(x-1);
}