aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2002-02-19 23:09:05 -0500
committerJason Merrill <jason@gcc.gnu.org>2002-02-19 23:09:05 -0500
commit6ea868b758701be4ac1fe50fb40bac04a0a3ba74 (patch)
tree23c362ccc96375e3c6ef8f73a903f6de8302e802
parente4e35417f9086711be36ab2e4bcdd2a2ab8bbc60 (diff)
downloadgcc-6ea868b758701be4ac1fe50fb40bac04a0a3ba74.zip
gcc-6ea868b758701be4ac1fe50fb40bac04a0a3ba74.tar.gz
gcc-6ea868b758701be4ac1fe50fb40bac04a0a3ba74.tar.bz2
ABI change: Mangle `void (A::*)() const' as M1AKFvvE, not MK1AFvvE.
ABI change: Mangle `void (A::*)() const' as M1AKFvvE, not MK1AFvvE. * mangle.c (write_function_type): Write cv-quals for member function type here. (write_pointer_to_member_type): Not here. From-SVN: r49887
-rw-r--r--gcc/cp/ChangeLog8
-rw-r--r--gcc/cp/mangle.c30
-rw-r--r--gcc/testsuite/g++.dg/abi/mangle5.C6
3 files changed, 26 insertions, 18 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 587ce8e..3f40163 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,11 @@
+2002-02-19 Jason Merrill <jason@redhat.com>
+
+ ABI change: Mangle `void (A::*)() const' as
+ M1AKFvvE, not MK1AFvvE.
+ * mangle.c (write_function_type): Write cv-quals for member
+ function type here.
+ (write_pointer_to_member_type): Not here.
+
2002-02-18 Jason Merrill <jason@redhat.com>
* pt.c (do_type_instantiation): Don't pedwarn if in_system_header.
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 00e5143..360e1fc 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -1595,6 +1595,17 @@ write_function_type (type)
{
MANGLE_TRACE_TREE ("function-type", type);
+ /* For a pointer to member function, the function type may have
+ cv-qualifiers, indicating the quals for the artificial 'this'
+ parameter. */
+ if (TREE_CODE (type) == METHOD_TYPE)
+ {
+ /* The first parameter must be a POINTER_TYPE pointing to the
+ `this' parameter. */
+ tree this_type = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (type)));
+ write_CV_qualifiers_for_type (this_type);
+ }
+
write_char ('F');
/* We don't track whether or not a type is `extern "C"'. Note that
you can have an `extern "C"' function that does not have
@@ -2021,24 +2032,7 @@ write_pointer_to_member_type (type)
tree type;
{
write_char ('M');
- /* For a pointer-to-function member, the class type may be
- cv-qualified, but that won't be reflected in
- TYPE_PTRMEM_CLASS_TYPE. So, we go fishing around in
- TYPE_PTRMEM_POINTED_TO_TYPE instead. */
- if (TYPE_PTRMEMFUNC_P (type))
- {
- tree fn_type;
- tree this_type;
-
- fn_type = TYPE_PTRMEM_POINTED_TO_TYPE (type);
- /* The first parameter must be a POINTER_TYPE pointing to the
- `this' parameter. */
- this_type = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (fn_type)));
- write_type (this_type);
- }
- /* For a pointer-to-data member, things are simpler. */
- else
- write_type (TYPE_PTRMEM_CLASS_TYPE (type));
+ write_type (TYPE_PTRMEM_CLASS_TYPE (type));
write_type (TYPE_PTRMEM_POINTED_TO_TYPE (type));
}
diff --git a/gcc/testsuite/g++.dg/abi/mangle5.C b/gcc/testsuite/g++.dg/abi/mangle5.C
new file mode 100644
index 0000000..99a0873
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/mangle5.C
@@ -0,0 +1,6 @@
+// Test mangling of pointers to cv-qualified member functions
+
+struct A;
+void f (void (A::*)() const) {}
+
+// { dg-final { scan-assembler "\n_?_Z1fM1AKFvvE\[: \t\n\]" } }