* call.c (standard_conversion): Tweak handling of
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 27 Jul 2003 18:25:57 +0000 (18:25 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 27 Jul 2003 18:25:57 +0000 (18:25 +0000)
pointer-to-member types.
* pt.c (tsubst): Correctly qualify pointers-to-data member types.
* typeck.c (comp_ptr_ttypes_real): Check qualifiers on
pointer-to-data member types.

* g++.dg/template/ptrmem6.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@69855 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/pt.c
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/ptrmem6.C [new file with mode: 0644]

index ad86f1a..209e1ad 100644 (file)
@@ -1,3 +1,11 @@
+2003-07-27  Mark Mitchell  <mark@codesourcery.com>
+
+       * call.c (standard_conversion): Tweak handling of
+       pointer-to-member types.
+       * pt.c (tsubst): Correctly qualify pointers-to-data member types.
+       * typeck.c (comp_ptr_ttypes_real): Check qualifiers on
+       pointer-to-data member types.
+
 2003-07-27  Nathan Sidwell  <nathan@codesourcery.com>
 
        * parser.c (cp_parser_type_parameter): Reformat.
index 58888ea..7e3302f 100644 (file)
@@ -715,8 +715,8 @@ standard_conversion (tree to, tree from, tree expr)
        }
       else
        {
-         to_pointee = to;
-         from_pointee = from;
+         to_pointee = TYPE_PTRMEM_POINTED_TO_TYPE (to);
+         from_pointee = TYPE_PTRMEM_POINTED_TO_TYPE (from);
        }
 
       if (same_type_p (from, to))
index 6670372..efbf75a 100644 (file)
@@ -6827,7 +6827,9 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
            return build_ptrmemfunc_type (build_pointer_type (method_type));
          }
        else
-         return build_ptrmem_type (r, type);
+         return cp_build_qualified_type_real (build_ptrmem_type (r, type),
+                                              TYPE_QUALS (t),
+                                              complain);
       }
     case FUNCTION_TYPE:
     case METHOD_TYPE:
index faa7197..ec6765b 100644 (file)
@@ -6013,9 +6013,9 @@ comp_ptr_ttypes_real (tree to, tree from, int constp)
        return 0;
 
       if (TREE_CODE (from) == OFFSET_TYPE
-         && same_type_p (TYPE_OFFSET_BASETYPE (from),
-                         TYPE_OFFSET_BASETYPE (to)))
-         continue;
+         && !same_type_p (TYPE_OFFSET_BASETYPE (from),
+                          TYPE_OFFSET_BASETYPE (to)))
+       return 0;
 
       /* Const and volatile mean something different for function types,
         so the usual checks are not appropriate.  */
@@ -6035,7 +6035,7 @@ comp_ptr_ttypes_real (tree to, tree from, int constp)
            constp &= TYPE_READONLY (to);
        }
 
-      if (TREE_CODE (to) != POINTER_TYPE)
+      if (TREE_CODE (to) != POINTER_TYPE && !TYPE_PTR_TO_MEMBER_P (to))
        return ((constp >= 0 || to_more_cv_qualified)
                && same_type_ignoring_top_level_qualifiers_p (to, from));
     }
index c06df55..1057be5 100644 (file)
@@ -1,3 +1,7 @@
+2003-07-27  Mark Mitchell  <mark@codesourcery.com>
+
+       * g++.dg/template/ptrmem6.C: New test.
+
 2003-07-26  Geoffrey Keating  <geoffk@apple.com>
 
        * gcc.c-torture/compile/zero-strct-2.c: New test.
diff --git a/gcc/testsuite/g++.dg/template/ptrmem6.C b/gcc/testsuite/g++.dg/template/ptrmem6.C
new file mode 100644 (file)
index 0000000..0d7dec2
--- /dev/null
@@ -0,0 +1,10 @@
+struct S {};
+
+void g(int S::**);
+
+template <typename T>
+void f (int T::* volatile *p) {
+  g(p); // { dg-error "" }
+}
+
+template void f(int S::* volatile *); // { dg-error "instantiated" }