Debian Codegraph @

gcc/testsuite/g++.dg/tm/dynamic2.C

raw
1 // { dg-options "-fgnu-tm -std=c++14 -O2" }
2
3 void unsafe();
4 struct A {
5 virtual void f() transaction_safe_dynamic;
6 };
7 struct B:A {
8 void f() { unsafe(); }
9 };
10
11 void f() transaction_safe {
12 B b;
13 A& ar = b;
14 // This is undefined behavior, we want to give an error with
15 // devirtualization.
16 ar.f(); // { dg-error "unsafe" }
17 }