aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/mangle.cc
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2023-12-15 10:03:26 -0500
committerPatrick Palka <ppalka@redhat.com>2023-12-15 10:03:26 -0500
commit46984fa259436ad50afb50a46a0a16e83bdf7172 (patch)
tree1c5a5c038cbaf467bb4a73b379a97dc74e504b13 /gcc/cp/mangle.cc
parent863df360fb6549ae35af9f052343d2578d4d2b63 (diff)
downloadgcc-46984fa259436ad50afb50a46a0a16e83bdf7172.zip
gcc-46984fa259436ad50afb50a46a0a16e83bdf7172.tar.gz
gcc-46984fa259436ad50afb50a46a0a16e83bdf7172.tar.bz2
c++: abi_tag attribute on templates [PR109715]
We need to look through TEMPLATE_DECL when looking up the abi_tag attribute (as with other function/variable declaration attributes). PR c++/109715 gcc/cp/ChangeLog: * mangle.cc (get_abi_tags): Strip TEMPLATE_DECL before looking up the abi_tag attribute. gcc/testsuite/ChangeLog: * g++.dg/abi/abi-tag25.C: New test. * g++.dg/abi/abi-tag25a.C: New test.
Diffstat (limited to 'gcc/cp/mangle.cc')
-rw-r--r--gcc/cp/mangle.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/cp/mangle.cc b/gcc/cp/mangle.cc
index 0684f0e..365d470 100644
--- a/gcc/cp/mangle.cc
+++ b/gcc/cp/mangle.cc
@@ -530,6 +530,16 @@ get_abi_tags (tree t)
if (DECL_P (t) && DECL_DECLARES_TYPE_P (t))
t = TREE_TYPE (t);
+ if (TREE_CODE (t) == TEMPLATE_DECL && DECL_TEMPLATE_RESULT (t))
+ {
+ tree tags = get_abi_tags (DECL_TEMPLATE_RESULT (t));
+ /* We used to overlook abi_tag on function and variable templates. */
+ if (tags && abi_check (19))
+ return tags;
+ else
+ return NULL_TREE;
+ }
+
tree attrs;
if (TYPE_P (t))
attrs = TYPE_ATTRIBUTES (t);