Message ID | 20230322160448.2494466-1-jason@redhat.com |
---|---|
State | New |
Headers | show |
Series | [pushed] c++: attribute on dtor in template [PR108795] | expand |
diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc index 87c2e8a7111..99a76e3ed65 100644 --- a/gcc/cp/semantics.cc +++ b/gcc/cp/semantics.cc @@ -4238,6 +4238,7 @@ finish_id_expression_1 (tree id_expression, : CP_ID_KIND_UNQUALIFIED))); if (dependent_p + && !scope && DECL_P (decl) && any_dependent_type_attributes_p (DECL_ATTRIBUTES (decl))) /* Dependent type attributes on the decl mean that the TREE_TYPE is diff --git a/gcc/testsuite/g++.dg/ext/attr-tsafe1.C b/gcc/testsuite/g++.dg/ext/attr-tsafe1.C new file mode 100644 index 00000000000..20c319f154d --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attr-tsafe1.C @@ -0,0 +1,14 @@ +// PR c++/108795 + +template <typename T> void g (T x) +{ + struct C + { + __attribute__((transaction_safe)) ~C(); + }; + C::~C(); // { dg-error "" } +} +void f () +{ + g (5); +}