call.c (standard_conversion): Tweak handling of pointer-to-member types.
* 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. * g++.dg/template/ptrmem6.C: New test. From-SVN: r69855
This commit is contained in:
parent
90ea7324e8
commit
b7a78333b1
@ -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.
|
||||
|
@ -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))
|
||||
|
@ -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:
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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.
|
||||
|
10
gcc/testsuite/g++.dg/template/ptrmem6.C
Normal file
10
gcc/testsuite/g++.dg/template/ptrmem6.C
Normal file
@ -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" }
|
Loading…
Reference in New Issue
Block a user