aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/mangle.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/mangle.c')
-rw-r--r--gcc/cp/mangle.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index e2641a7..18f99a10 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -1928,7 +1928,24 @@ write_pointer_to_member_type (type)
tree type;
{
write_char ('M');
- write_type (TYPE_PTRMEM_CLASS_TYPE (type));
+ /* For a pointer-to-function member, the class type may be
+ cv-qualified, bug 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_POINTED_TO_TYPE (type));
}