aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2016-08-09 12:55:08 -0400
committerJason Merrill <jason@gcc.gnu.org>2016-08-09 12:55:08 -0400
commitd676d623eb1e2aabcb2d3c10574a1c240083a22a (patch)
treefcb212b968d063912e69b811896ed264aa70ec6a
parent7ab8c6470c6275fd9e58038f1dd3e8744bebe2bc (diff)
downloadgcc-d676d623eb1e2aabcb2d3c10574a1c240083a22a.zip
gcc-d676d623eb1e2aabcb2d3c10574a1c240083a22a.tar.gz
gcc-d676d623eb1e2aabcb2d3c10574a1c240083a22a.tar.bz2
PR c++/71712 - ABI tags on conversion ops.
* class.c (check_abi_tags): Don't duplicate tags for conversion ops. From-SVN: r239299
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/class.c4
-rw-r--r--gcc/cp/mangle.c9
-rw-r--r--gcc/testsuite/g++.dg/abi/abi-tag22.C11
-rw-r--r--gcc/testsuite/g++.dg/abi/abi-tag22a.C11
5 files changed, 38 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 81ca1a1..c71ea17 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2016-08-09 Jason Merrill <jason@redhat.com>
+ PR c++/71712
+ * class.c (check_abi_tags): Don't duplicate tags for conversion ops.
+
Adjust mangling of ABI tags on class template member functions.
* class.c (missing_abi_tags): New.
(check_abi_tags): Don't check template. Add just_checking mode.
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index e21647a..10286a7 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -1618,6 +1618,7 @@ check_abi_tags (tree decl)
if (VAR_P (decl))
check_abi_tags (decl, TREE_TYPE (decl));
else if (TREE_CODE (decl) == FUNCTION_DECL
+ && !DECL_CONV_FN_P (decl)
&& !mangle_return_type_p (decl))
check_abi_tags (decl, TREE_TYPE (TREE_TYPE (decl)));
}
@@ -1632,6 +1633,9 @@ missing_abi_tags (tree decl)
if (VAR_P (decl))
return check_abi_tags (decl, TREE_TYPE (decl), true);
else if (TREE_CODE (decl) == FUNCTION_DECL
+ /* Don't check DECL_CONV_FN_P here like we do in check_abi_tags, so
+ that we can use this function for setting need_abi_warning
+ regardless of the current flag_abi_version. */
&& !mangle_return_type_p (decl))
return check_abi_tags (decl, TREE_TYPE (TREE_TYPE (decl)), true);
else
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index f7ff221..b42c6f9 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -1383,6 +1383,15 @@ write_unqualified_name (tree decl)
}
tree tags = get_abi_tags (decl);
+ if (TREE_CODE (decl) == FUNCTION_DECL && DECL_CONV_FN_P (decl)
+ && any_abi_below (11))
+ if (tree mtags = missing_abi_tags (decl))
+ {
+ if (abi_warn_or_compat_version_crosses (11))
+ G.need_abi_warning = true;
+ if (!abi_version_at_least (11))
+ tags = chainon (mtags, tags);
+ }
write_abi_tags (tags);
}
diff --git a/gcc/testsuite/g++.dg/abi/abi-tag22.C b/gcc/testsuite/g++.dg/abi/abi-tag22.C
new file mode 100644
index 0000000..e649233
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/abi-tag22.C
@@ -0,0 +1,11 @@
+// PR c++/71712
+// { dg-options -Wabi=10 }
+
+struct __attribute__((abi_tag("A", "B"))) A { };
+struct A18 {
+ operator A(); // { dg-warning "mangled name" }
+};
+void f18_test() {
+ // { dg-final { scan-assembler "_ZN3A18cv1AB1AB1BEv" } }
+ A a = A18();
+}
diff --git a/gcc/testsuite/g++.dg/abi/abi-tag22a.C b/gcc/testsuite/g++.dg/abi/abi-tag22a.C
new file mode 100644
index 0000000..c27fac6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/abi-tag22a.C
@@ -0,0 +1,11 @@
+// PR c++/71712
+// { dg-options "-fabi-version=10 -Wabi" }
+
+struct __attribute__((abi_tag("A", "B"))) A { };
+struct A18 {
+ operator A(); // { dg-warning "mangled name" }
+};
+void f18_test() {
+ // { dg-final { scan-assembler "_ZN3A18cv1AB1AB1BB1AB1BEv" } }
+ A a = A18();
+}