summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/cp/ChangeLog29
-rw-r--r--gcc/cp/call.c41
-rw-r--r--gcc/cp/class.c3
-rw-r--r--gcc/cp/cp-objcp-common.c4
-rw-r--r--gcc/cp/cp-tree.h16
-rw-r--r--gcc/cp/cvt.c11
-rw-r--r--gcc/cp/cxx-pretty-print.c7
-rw-r--r--gcc/cp/decl.c2
-rw-r--r--gcc/cp/init.c2
-rw-r--r--gcc/cp/mangle.c2
-rw-r--r--gcc/cp/name-lookup.c2
-rw-r--r--gcc/cp/pt.c12
-rw-r--r--gcc/cp/rtti.c2
-rw-r--r--gcc/cp/tree.c2
-rw-r--r--gcc/cp/typeck.c49
-rw-r--r--gcc/cp/typeck2.c4
17 files changed, 111 insertions, 81 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6076af923a9..57c9ec10a00 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2012-05-12 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * doc/generic.texi: Rename TYPE_PTRMEM_P to TYPE_PTRDATAMEM_P.
+
2012-05-12 Uros Bizjak <ubizjak@gmail.com>
* config/alpha/alpha.c (alpha_emit_conditional_branch): Handle
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index bf9dc573547..3555be4c22f 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,34 @@
2012-05-12 Paolo Carlini <paolo.carlini@oracle.com>
+ * cp-tree.h (TYPE_PTRMEM_P): Rename to TYPE_PTRDATAMEM_P.
+ (TYPE_PTR_TO_MEMBER_P): Rename to TYPE_PTRMEM_P.
+ (TYPE_PTR_OR_PTRMEM_P): Add.
+ * typeck.c (composite_pointer_type_r, composite_pointer_type,
+ common_pointer_type, cp_build_indirect_ref, cp_build_binary_op,
+ cp_truthvalue_conversion, convert_ptrmem, build_static_cast_1,
+ build_reinterpret_cast_1, build_const_cast_1, comp_ptr_ttypes_real,
+ casts_away_constness_r, casts_away_constness): Adjust.
+ * init.c (build_zero_init_1): Adjust.
+ * class.c (check_field_decls): Likewise.
+ * decl.c (check_default_argument): Likewise.
+ * rtti.c (target_incomplete_p): Likewise.
+ * tree.c (zero_init_p): Likewise.
+ * cxx-pretty-print.c (pp_cxx_ptr_operator,
+ pp_cxx_abstract_declarator): Likewise.
+ * typeck2.c (build_m_component_ref): Likewise.
+ * pt.c (convert_nontype_argument, invalid_nontype_parm_type_p,
+ dependent_type_p_r): Likewise.
+ * call.c (null_member_pointer_value_p, standard_conversion,
+ add_builtin_candidate, build_conditional_expr_1, compare_ics):
+ Likewise.
+ * cp-objcp-common.c (cp_var_mod_type_p): Likewise.
+ * cvt.c (cp_convert_to_pointer, ocp_convert,
+ perform_qualification_conversions): Likewise.
+ * mangle.c (write_type): Likewise.
+ * name-lookup.c (arg_assoc_type): Likewise.
+
+2012-05-12 Paolo Carlini <paolo.carlini@oracle.com>
+
* parser.c (struct cp_parser_expression_stack_entry): Add location_t
field.
(cp_parser_binary_expression): Rework to always update at the same
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 8497bfa3cb4..daaae2b6ead 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -578,7 +578,7 @@ null_member_pointer_value_p (tree t)
else if (TYPE_PTRMEMFUNC_P (type))
return (TREE_CODE (t) == CONSTRUCTOR
&& integer_zerop (CONSTRUCTOR_ELT (t, 0)->value));
- else if (TYPE_PTRMEM_P (type))
+ else if (TYPE_PTRDATAMEM_P (type))
return integer_all_onesp (t);
else
return false;
@@ -1162,7 +1162,7 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p,
A null pointer constant can be converted to a pointer type; ... A
null pointer constant of integral type can be converted to an
rvalue of type std::nullptr_t. */
- if ((tcode == POINTER_TYPE || TYPE_PTR_TO_MEMBER_P (to)
+ if ((tcode == POINTER_TYPE || TYPE_PTRMEM_P (to)
|| NULLPTR_TYPE_P (to))
&& expr && null_ptr_cst_p (expr))
conv = build_conv (ck_std, to, conv);
@@ -1182,7 +1182,7 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p,
conv->bad_p = true;
}
else if ((tcode == POINTER_TYPE && fcode == POINTER_TYPE)
- || (TYPE_PTRMEM_P (to) && TYPE_PTRMEM_P (from)))
+ || (TYPE_PTRDATAMEM_P (to) && TYPE_PTRDATAMEM_P (from)))
{
tree to_pointee;
tree from_pointee;
@@ -1192,7 +1192,7 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p,
TREE_TYPE (to)))
;
else if (VOID_TYPE_P (TREE_TYPE (to))
- && !TYPE_PTRMEM_P (from)
+ && !TYPE_PTRDATAMEM_P (from)
&& TREE_CODE (TREE_TYPE (from)) != FUNCTION_TYPE)
{
tree nfrom = TREE_TYPE (from);
@@ -1201,7 +1201,7 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p,
cp_type_quals (nfrom)));
conv = build_conv (ck_ptr, from, conv);
}
- else if (TYPE_PTRMEM_P (from))
+ else if (TYPE_PTRDATAMEM_P (from))
{
tree fbase = TYPE_PTRMEM_CLASS_TYPE (from);
tree tbase = TYPE_PTRMEM_CLASS_TYPE (to);
@@ -1307,12 +1307,12 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p,
if (ARITHMETIC_TYPE_P (from)
|| UNSCOPED_ENUM_P (from)
|| fcode == POINTER_TYPE
- || TYPE_PTR_TO_MEMBER_P (from)
+ || TYPE_PTRMEM_P (from)
|| NULLPTR_TYPE_P (from))
{
conv = build_conv (ck_std, to, conv);
if (fcode == POINTER_TYPE
- || TYPE_PTRMEM_P (from)
+ || TYPE_PTRDATAMEM_P (from)
|| (TYPE_PTRMEMFUNC_P (from)
&& conv->rank < cr_pbool)
|| NULLPTR_TYPE_P (from))
@@ -2334,7 +2334,7 @@ add_builtin_candidate (struct z_candidate **candidates, enum tree_code code,
case MEMBER_REF:
if (TREE_CODE (type1) == POINTER_TYPE
- && TYPE_PTR_TO_MEMBER_P (type2))
+ && TYPE_PTRMEM_P (type2))
{
tree c1 = TREE_TYPE (type1);
tree c2 = TYPE_PTRMEM_CLASS_TYPE (type2);
@@ -2406,14 +2406,14 @@ add_builtin_candidate (struct z_candidate **candidates, enum tree_code code,
case EQ_EXPR:
case NE_EXPR:
if ((TYPE_PTRMEMFUNC_P (type1) && TYPE_PTRMEMFUNC_P (type2))
- || (TYPE_PTRMEM_P (type1) && TYPE_PTRMEM_P (type2)))
+ || (TYPE_PTRDATAMEM_P (type1) && TYPE_PTRDATAMEM_P (type2)))
break;
- if (TYPE_PTR_TO_MEMBER_P (type1) && null_ptr_cst_p (args[1]))
+ if (TYPE_PTRMEM_P (type1) && null_ptr_cst_p (args[1]))
{
type2 = type1;
break;
}
- if (TYPE_PTR_TO_MEMBER_P (type2) && null_ptr_cst_p (args[0]))
+ if (TYPE_PTRMEM_P (type2) && null_ptr_cst_p (args[0]))
{
type1 = type2;
break;
@@ -2552,7 +2552,7 @@ add_builtin_candidate (struct z_candidate **candidates, enum tree_code code,
break;
if ((TYPE_PTRMEMFUNC_P (type1) && TYPE_PTRMEMFUNC_P (type2))
|| (TYPE_PTR_P (type1) && TYPE_PTR_P (type2))
- || (TYPE_PTRMEM_P (type1) && TYPE_PTRMEM_P (type2))
+ || (TYPE_PTRDATAMEM_P (type1) && TYPE_PTRDATAMEM_P (type2))
|| ((TYPE_PTRMEMFUNC_P (type1)
|| TREE_CODE (type1) == POINTER_TYPE)
&& null_ptr_cst_p (args[1])))
@@ -2589,8 +2589,7 @@ add_builtin_candidate (struct z_candidate **candidates, enum tree_code code,
break;
/* Otherwise, the types should be pointers. */
- if (!(TYPE_PTR_P (type1) || TYPE_PTR_TO_MEMBER_P (type1))
- || !(TYPE_PTR_P (type2) || TYPE_PTR_TO_MEMBER_P (type2)))
+ if (!TYPE_PTR_OR_PTRMEM_P (type1) || !TYPE_PTR_OR_PTRMEM_P (type2))
return;
/* We don't check that the two types are the same; the logic
@@ -2615,12 +2614,12 @@ add_builtin_candidate (struct z_candidate **candidates, enum tree_code code,
&& TREE_CODE (type1) == TREE_CODE (type2)
&& (TREE_CODE (type1) == REFERENCE_TYPE
|| (TYPE_PTR_P (type1) && TYPE_PTR_P (type2))
- || (TYPE_PTRMEM_P (type1) && TYPE_PTRMEM_P (type2))
+ || (TYPE_PTRDATAMEM_P (type1) && TYPE_PTRDATAMEM_P (type2))
|| TYPE_PTRMEMFUNC_P (type1)
|| MAYBE_CLASS_TYPE_P (type1)
|| TREE_CODE (type1) == ENUMERAL_TYPE))
{
- if (TYPE_PTR_P (type1) || TYPE_PTR_TO_MEMBER_P (type1))
+ if (TYPE_PTR_OR_PTRMEM_P (type1))
{
tree cptype = composite_pointer_type (type1, type2,
error_mark_node,
@@ -4733,11 +4732,11 @@ build_conditional_expr_1 (tree arg1, tree arg2, tree arg3,
cv-qualification of either the second or the third operand.
The result is of the common type. */
else if ((null_ptr_cst_p (arg2)
- && (TYPE_PTR_P (arg3_type) || TYPE_PTR_TO_MEMBER_P (arg3_type)))
+ && TYPE_PTR_OR_PTRMEM_P (arg3_type))
|| (null_ptr_cst_p (arg3)
- && (TYPE_PTR_P (arg2_type) || TYPE_PTR_TO_MEMBER_P (arg2_type)))
+ && TYPE_PTR_OR_PTRMEM_P (arg2_type))
|| (TYPE_PTR_P (arg2_type) && TYPE_PTR_P (arg3_type))
- || (TYPE_PTRMEM_P (arg2_type) && TYPE_PTRMEM_P (arg3_type))
+ || (TYPE_PTRDATAMEM_P (arg2_type) && TYPE_PTRDATAMEM_P (arg3_type))
|| (TYPE_PTRMEMFUNC_P (arg2_type) && TYPE_PTRMEMFUNC_P (arg3_type)))
{
result_type = composite_pointer_type (arg2_type, arg3_type, arg2,
@@ -7857,8 +7856,8 @@ compare_ics (conversion *ics1, conversion *ics2)
for pointers A*, except opposite: if B is derived from A then
A::* converts to B::*, not vice versa. For that reason, we
switch the from_ and to_ variables here. */
- else if ((TYPE_PTRMEM_P (from_type1) && TYPE_PTRMEM_P (from_type2)
- && TYPE_PTRMEM_P (to_type1) && TYPE_PTRMEM_P (to_type2))
+ else if ((TYPE_PTRDATAMEM_P (from_type1) && TYPE_PTRDATAMEM_P (from_type2)
+ && TYPE_PTRDATAMEM_P (to_type1) && TYPE_PTRDATAMEM_P (to_type2))
|| (TYPE_PTRMEMFUNC_P (from_type1)
&& TYPE_PTRMEMFUNC_P (from_type2)
&& TYPE_PTRMEMFUNC_P (to_type1)
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 00aeefd5d48..5aef0fe71f4 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -3219,8 +3219,7 @@ check_field_decls (tree t, tree *access_decls,
to members which might hold dynamic memory. So do not warn
for pointers to functions or pointers to members. */
if (TYPE_PTR_P (type)
- && !TYPE_PTRFN_P (type)
- && !TYPE_PTR_TO_MEMBER_P (type))
+ && !TYPE_PTRFN_P (type))
has_pointers = true;
if (CLASS_TYPE_P (type))
diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c
index a957a0303ac..9b7d361939c 100644
--- a/gcc/cp/cp-objcp-common.c
+++ b/gcc/cp/cp-objcp-common.c
@@ -1,5 +1,5 @@
/* Some code common to C++ and ObjC++ front ends.
- Copyright (C) 2004, 2007, 2008, 2009, 2010, 2011
+ Copyright (C) 2004, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
Contributed by Ziemowit Laski <zlaski@apple.com>
@@ -118,7 +118,7 @@ cp_var_mod_type_p (tree type, tree fn)
{
/* If TYPE is a pointer-to-member, it is variably modified if either
the class or the member are variably modified. */
- if (TYPE_PTR_TO_MEMBER_P (type))
+ if (TYPE_PTRMEM_P (type))
return (variably_modified_type_p (TYPE_PTRMEM_CLASS_TYPE (type), fn)
|| variably_modified_type_p (TYPE_PTRMEM_POINTED_TO_TYPE (type),
fn));
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 141b559eb74..e5ec1d4841f 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -3191,7 +3191,7 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
Keep these checks in ascending code order. */
#define SCALAR_TYPE_P(TYPE) \
- (TYPE_PTRMEM_P (TYPE) \
+ (TYPE_PTRDATAMEM_P (TYPE) \
|| TREE_CODE (TYPE) == ENUMERAL_TYPE \
|| ARITHMETIC_TYPE_P (TYPE) \
|| TYPE_PTR_P (TYPE) \
@@ -3376,7 +3376,7 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
(TYPE_HAS_COPY_ASSIGN (NODE) && ! TYPE_HAS_COMPLEX_COPY_ASSIGN (NODE))
/* Returns true if NODE is a pointer-to-data-member. */
-#define TYPE_PTRMEM_P(NODE) \
+#define TYPE_PTRDATAMEM_P(NODE) \
(TREE_CODE (NODE) == OFFSET_TYPE)
/* Returns true if NODE is a pointer. */
#define TYPE_PTR_P(NODE) \
@@ -3434,8 +3434,12 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
(LANG_TYPE_CLASS_CHECK (NODE)->ptrmemfunc_flag)
/* Returns true if NODE is a pointer-to-member. */
-#define TYPE_PTR_TO_MEMBER_P(NODE) \
- (TYPE_PTRMEM_P (NODE) || TYPE_PTRMEMFUNC_P (NODE))
+#define TYPE_PTRMEM_P(NODE) \
+ (TYPE_PTRDATAMEM_P (NODE) || TYPE_PTRMEMFUNC_P (NODE))
+
+/* Returns true if NODE is a pointer or a pointer-to-member. */
+#define TYPE_PTR_OR_PTRMEM_P(NODE) \
+ (TYPE_PTR_P (NODE) || TYPE_PTRMEM_P (NODE))
/* Indicates when overload resolution may resolve to a pointer to
member function. [expr.unary.op]/3 */
@@ -3473,13 +3477,13 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
TYPE_PTRMEM_POINTED_TO_TYPE; there, the first parameter will have
type `const X*'. */
#define TYPE_PTRMEM_CLASS_TYPE(NODE) \
- (TYPE_PTRMEM_P (NODE) \
+ (TYPE_PTRDATAMEM_P (NODE) \
? TYPE_OFFSET_BASETYPE (NODE) \
: TYPE_PTRMEMFUNC_OBJECT_TYPE (NODE))
/* For a pointer-to-member type of the form `T X::*', this is `T'. */
#define TYPE_PTRMEM_POINTED_TO_TYPE(NODE) \
- (TYPE_PTRMEM_P (NODE) \
+ (TYPE_PTRDATAMEM_P (NODE) \
? TREE_TYPE (NODE) \
: TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (NODE)))
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index 3d8f7021d1f..ebd750529c6 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -175,7 +175,7 @@ cp_convert_to_pointer (tree type, tree expr)
return build_nop (type, expr);
}
- else if ((TYPE_PTRMEM_P (type) && TYPE_PTRMEM_P (intype))
+ else if ((TYPE_PTRDATAMEM_P (type) && TYPE_PTRDATAMEM_P (intype))
|| (TYPE_PTRMEMFUNC_P (type) && TYPE_PTRMEMFUNC_P (intype)))
return convert_ptrmem (type, expr, /*allow_inverse_p=*/false,
/*c_cast_p=*/false, tf_warning_or_error);
@@ -210,7 +210,7 @@ cp_convert_to_pointer (tree type, tree expr)
return build_ptrmemfunc (TYPE_PTRMEMFUNC_FN_TYPE (type), expr, 0,
/*c_cast_p=*/false, tf_warning_or_error);
- if (TYPE_PTRMEM_P (type))
+ if (TYPE_PTRDATAMEM_P (type))
{
/* A NULL pointer-to-member is represented by -1, not by
zero. */
@@ -221,7 +221,7 @@ cp_convert_to_pointer (tree type, tree expr)
return expr;
}
- else if (TYPE_PTR_TO_MEMBER_P (type) && INTEGRAL_CODE_P (form))
+ else if (TYPE_PTRMEM_P (type) && INTEGRAL_CODE_P (form))
{
error_at (loc, "invalid conversion from %qT to %qT", intype, type);
return error_mark_node;
@@ -767,7 +767,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags)
}
if (NULLPTR_TYPE_P (type) && e && null_ptr_cst_p (e))
return nullptr_node;
- if (POINTER_TYPE_P (type) || TYPE_PTR_TO_MEMBER_P (type))
+ if (POINTER_TYPE_P (type) || TYPE_PTRMEM_P (type))
return fold_if_not_in_template (cp_convert_to_pointer (type, e));
if (code == VECTOR_TYPE)
{
@@ -1722,8 +1722,7 @@ perform_qualification_conversions (tree type, tree expr)
else if (TYPE_PTR_P (type) && TYPE_PTR_P (expr_type)
&& comp_ptr_ttypes (TREE_TYPE (type), TREE_TYPE (expr_type)))
return build_nop (type, expr);
- else if (TYPE_PTR_TO_MEMBER_P (type)
- && TYPE_PTR_TO_MEMBER_P (expr_type)
+ else if (TYPE_PTRMEM_P (type) && TYPE_PTRMEM_P (expr_type)
&& same_type_p (TYPE_PTRMEM_CLASS_TYPE (type),
TYPE_PTRMEM_CLASS_TYPE (expr_type))
&& comp_ptr_ttypes (TYPE_PTRMEM_POINTED_TO_TYPE (type),
diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c
index cb7922f04c6..eef3489e762 100644
--- a/gcc/cp/cxx-pretty-print.c
+++ b/gcc/cp/cxx-pretty-print.c
@@ -1345,8 +1345,7 @@ pp_cxx_ptr_operator (cxx_pretty_printer *pp, tree t)
{
case REFERENCE_TYPE:
case POINTER_TYPE:
- if (TREE_CODE (TREE_TYPE (t)) == POINTER_TYPE
- || TYPE_PTR_TO_MEMBER_P (TREE_TYPE (t)))
+ if (TYPE_PTR_OR_PTRMEM_P (TREE_TYPE (t)))
pp_cxx_ptr_operator (pp, TREE_TYPE (t));
pp_c_attributes_display (pp_c_base (pp),
TYPE_ATTRIBUTES (TREE_TYPE (t)));
@@ -1368,7 +1367,7 @@ pp_cxx_ptr_operator (cxx_pretty_printer *pp, tree t)
break;
}
case OFFSET_TYPE:
- if (TYPE_PTR_TO_MEMBER_P (t))
+ if (TYPE_PTRMEM_P (t))
{
if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
pp_cxx_left_paren (pp);
@@ -1641,7 +1640,7 @@ pp_cxx_function_definition (cxx_pretty_printer *pp, tree t)
static void
pp_cxx_abstract_declarator (cxx_pretty_printer *pp, tree t)
{
- if (TYPE_PTRMEM_P (t) || TYPE_PTRMEMFUNC_P (t))
+ if (TYPE_PTRMEM_P (t))
pp_cxx_right_paren (pp);
else if (POINTER_TYPE_P (t))
{
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 0e833b1b0e3..8d7d7451768 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -10619,7 +10619,7 @@ check_default_argument (tree decl, tree arg)
if (warn_zero_as_null_pointer_constant
&& c_inhibit_evaluation_warnings == 0
- && (TYPE_PTR_P (decl_type) || TYPE_PTR_TO_MEMBER_P (decl_type))
+ && TYPE_PTR_OR_PTRMEM_P (decl_type)
&& null_ptr_cst_p (arg)
&& !NULLPTR_TYPE_P (TREE_TYPE (arg)))
{
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index e8debb870d6..ca6f14af370 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -178,7 +178,7 @@ build_zero_init_1 (tree type, tree nelts, bool static_storage_p,
items with static storage duration that are not otherwise
initialized are initialized to zero. */
;
- else if (TYPE_PTR_P (type) || TYPE_PTR_TO_MEMBER_P (type))
+ else if (TYPE_PTR_OR_PTRMEM_P (type))
init = convert (type, nullptr_node);
else if (SCALAR_TYPE_P (type))
init = convert (type, integer_zero_node);
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index d00df1fe49a..c8018483b81 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -1845,7 +1845,7 @@ write_type (tree type)
if (TREE_CODE (type) == RECORD_TYPE && TYPE_TRANSPARENT_AGGR (type))
type = TREE_TYPE (first_field (type));
- if (TYPE_PTRMEM_P (type))
+ if (TYPE_PTRDATAMEM_P (type))
write_pointer_to_member_type (type);
else
{
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 3693f7b2db9..6930502012b 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -5309,7 +5309,7 @@ arg_assoc_type (struct arg_lookup *k, tree type)
if (!type)
return false;
- if (TYPE_PTRMEM_P (type))
+ if (TYPE_PTRDATAMEM_P (type))
{
/* Pointer to member: associate class type and value type. */
if (arg_assoc_type (k, TYPE_PTRMEM_CLASS_TYPE (type)))
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 77c95bc259e..051abb8a05c 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -5720,8 +5720,7 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain)
/* 14.3.2/5: The null pointer{,-to-member} conversion is applied
to a non-type argument of "nullptr". */
- if (expr == nullptr_node
- && (TYPE_PTR_P (type) || TYPE_PTR_TO_MEMBER_P (type)))
+ if (expr == nullptr_node && TYPE_PTR_OR_PTRMEM_P (type))
expr = convert (type, expr);
/* In C++11, integral or enumeration non-type template arguments can be
@@ -5737,8 +5736,7 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain)
CONSTRUCTOR. */;
else if (INTEGRAL_OR_ENUMERATION_TYPE_P (type))
expr = maybe_constant_value (expr);
- else if (TYPE_PTR_P (type)
- || TYPE_PTR_TO_MEMBER_P (type))
+ else if (TYPE_PTR_OR_PTRMEM_P (type))
{
tree folded = maybe_constant_value (expr);
if (TYPE_PTR_P (type) ? integer_zerop (folded)
@@ -6073,7 +6071,7 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain)
For a non-type template-parameter of type pointer to data member,
qualification conversions (_conv.qual_) are applied. */
- else if (TYPE_PTRMEM_P (type))
+ else if (TYPE_PTRDATAMEM_P (type))
{
/* [temp.arg.nontype] bullet 1 says the pointer to member
expression must be a pointer-to-member constant. */
@@ -19169,7 +19167,7 @@ invalid_nontype_parm_type_p (tree type, tsubst_flags_t complain)
return 0;
else if (POINTER_TYPE_P (type))
return 0;
- else if (TYPE_PTR_TO_MEMBER_P (type))
+ else if (TYPE_PTRMEM_P (type))
return 0;
else if (TREE_CODE (type) == TEMPLATE_TYPE_PARM)
return 0;
@@ -19218,7 +19216,7 @@ dependent_type_p_r (tree type)
dependent. */
type = TYPE_MAIN_VARIANT (type);
/* -- a compound type constructed from any dependent type. */
- if (TYPE_PTR_TO_MEMBER_P (type))
+ if (TYPE_PTRMEM_P (type))
return (dependent_type_p (TYPE_PTRMEM_CLASS_TYPE (type))
|| dependent_type_p (TYPE_PTRMEM_POINTED_TO_TYPE
(type)));
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index 92427648497..bdeea713da8 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -816,7 +816,7 @@ static bool
target_incomplete_p (tree type)
{
while (true)
- if (TYPE_PTRMEM_P (type))
+ if (TYPE_PTRDATAMEM_P (type))
{
if (!COMPLETE_TYPE_P (TYPE_PTRMEM_CLASS_TYPE (type)))
return true;
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 918b9ccd55a..ad8f82db1d5 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -2773,7 +2773,7 @@ zero_init_p (const_tree t)
return 1;
/* NULL pointers to data members are initialized with -1. */
- if (TYPE_PTRMEM_P (t))
+ if (TYPE_PTRDATAMEM_P (t))
return 0;
/* Classes that contain types that can't be zero-initialized, cannot
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 7eed7548562..c50373884ec 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -509,8 +509,7 @@ composite_pointer_type_r (tree t1, tree t2,
result_type = pointee1;
else if ((TREE_CODE (pointee1) == POINTER_TYPE
&& TREE_CODE (pointee2) == POINTER_TYPE)
- || (TYPE_PTR_TO_MEMBER_P (pointee1)
- && TYPE_PTR_TO_MEMBER_P (pointee2)))
+ || (TYPE_PTRMEM_P (pointee1) && TYPE_PTRMEM_P (pointee2)))
{
result_type = composite_pointer_type_r (pointee1, pointee2, operation,
complain);
@@ -530,7 +529,7 @@ composite_pointer_type_r (tree t1, tree t2,
| cp_type_quals (pointee2)));
/* If the original types were pointers to members, so is the
result. */
- if (TYPE_PTR_TO_MEMBER_P (t1))
+ if (TYPE_PTRMEM_P (t1))
{
if (!same_type_p (TYPE_PTRMEM_CLASS_TYPE (t1),
TYPE_PTRMEM_CLASS_TYPE (t2)))
@@ -666,7 +665,7 @@ composite_pointer_type (tree t1, tree t2, tree arg1, tree arg2,
}
/* [expr.eq] permits the application of a pointer-to-member
conversion to change the class type of one of the types. */
- else if (TYPE_PTR_TO_MEMBER_P (t1)
+ else if (TYPE_PTRMEM_P (t1)
&& !same_type_p (TYPE_PTRMEM_CLASS_TYPE (t1),
TYPE_PTRMEM_CLASS_TYPE (t2)))
{
@@ -931,7 +930,7 @@ tree
common_pointer_type (tree t1, tree t2)
{
gcc_assert ((TYPE_PTR_P (t1) && TYPE_PTR_P (t2))
- || (TYPE_PTRMEM_P (t1) && TYPE_PTRMEM_P (t2))
+ || (TYPE_PTRDATAMEM_P (t1) && TYPE_PTRDATAMEM_P (t2))
|| (TYPE_PTRMEMFUNC_P (t1) && TYPE_PTRMEMFUNC_P (t2)));
return composite_pointer_type (t1, t2, error_mark_node, error_mark_node,
@@ -2835,7 +2834,7 @@ cp_build_indirect_ref (tree ptr, ref_operator errorstring,
;
/* `pointer' won't be an error_mark_node if we were given a
pointer to member, so it's cool to check for this here. */
- else if (TYPE_PTR_TO_MEMBER_P (type))
+ else if (TYPE_PTRMEM_P (type))
switch (errorstring)
{
case RO_ARRAY_INDEXING:
@@ -3839,9 +3838,9 @@ cp_build_binary_op (location_t location,
&& code != EQ_EXPR && code != NE_EXPR && code != MINUS_EXPR)
/* Or if one of OP0 or OP1 is neither a pointer nor NULL. */
|| (!null_ptr_cst_p (orig_op0)
- && !TYPE_PTR_P (type0) && !TYPE_PTR_TO_MEMBER_P (type0))
+ && !TYPE_PTR_OR_PTRMEM_P (type0))
|| (!null_ptr_cst_p (orig_op1)
- && !TYPE_PTR_P (type1) && !TYPE_PTR_TO_MEMBER_P (type1)))
+ && !TYPE_PTR_OR_PTRMEM_P (type1)))
&& (complain & tf_warning))
{
source_location loc =
@@ -4075,10 +4074,10 @@ cp_build_binary_op (location_t location,
|| code1 == COMPLEX_TYPE || code1 == ENUMERAL_TYPE))
short_compare = 1;
else if ((code0 == POINTER_TYPE && code1 == POINTER_TYPE)
- || (TYPE_PTRMEM_P (type0) && TYPE_PTRMEM_P (type1)))
+ || (TYPE_PTRDATAMEM_P (type0) && TYPE_PTRDATAMEM_P (type1)))
result_type = composite_pointer_type (type0, type1, op0, op1,
CPO_COMPARISON, complain);
- else if ((code0 == POINTER_TYPE || TYPE_PTRMEM_P (type0))
+ else if ((code0 == POINTER_TYPE || TYPE_PTRDATAMEM_P (type0))
&& null_ptr_cst_p (op1))
{
if (TREE_CODE (op0) == ADDR_EXPR
@@ -4091,7 +4090,7 @@ cp_build_binary_op (location_t location,
}
result_type = type0;
}
- else if ((code1 == POINTER_TYPE || TYPE_PTRMEM_P (type1))
+ else if ((code1 == POINTER_TYPE || TYPE_PTRDATAMEM_P (type1))
&& null_ptr_cst_p (op0))
{
if (TREE_CODE (op1) == ADDR_EXPR
@@ -4769,7 +4768,7 @@ tree
cp_truthvalue_conversion (tree expr)
{
tree type = TREE_TYPE (expr);
- if (TYPE_PTRMEM_P (type))
+ if (TYPE_PTRDATAMEM_P (type))
return build_binary_op (EXPR_LOCATION (expr),
NE_EXPR, expr, nullptr_node, 1);
else if (TYPE_PTR_P (type) || TYPE_PTRMEMFUNC_P (type))
@@ -5855,7 +5854,7 @@ tree
convert_ptrmem (tree type, tree expr, bool allow_inverse_p,
bool c_cast_p, tsubst_flags_t complain)
{
- if (TYPE_PTRMEM_P (type))
+ if (TYPE_PTRDATAMEM_P (type))
{
tree delta;
@@ -6088,7 +6087,7 @@ build_static_cast_1 (tree type, tree expr, bool c_cast_p,
return cp_fold_convert(type, expr);
}
- if ((TYPE_PTRMEM_P (type) && TYPE_PTRMEM_P (intype))
+ if ((TYPE_PTRDATAMEM_P (type) && TYPE_PTRDATAMEM_P (intype))
|| (TYPE_PTRMEMFUNC_P (type) && TYPE_PTRMEMFUNC_P (intype)))
{
tree c1;
@@ -6099,7 +6098,7 @@ build_static_cast_1 (tree type, tree expr, bool c_cast_p,
c1 = TYPE_PTRMEM_CLASS_TYPE (intype);
c2 = TYPE_PTRMEM_CLASS_TYPE (type);
- if (TYPE_PTRMEM_P (type))
+ if (TYPE_PTRDATAMEM_P (type))
{
t1 = (build_ptrmem_type
(c1,
@@ -6345,14 +6344,14 @@ build_reinterpret_cast_1 (tree type, tree expr, bool c_cast_p,
/* OK */
;
else if ((INTEGRAL_OR_ENUMERATION_TYPE_P (type)
- || TYPE_PTR_P (type) || TYPE_PTR_TO_MEMBER_P (type))
+ || TYPE_PTR_OR_PTRMEM_P (type))
&& same_type_p (type, intype))
/* DR 799 */
return fold_if_not_in_template (build_nop (type, expr));
else if ((TYPE_PTRFN_P (type) && TYPE_PTRFN_P (intype))
|| (TYPE_PTRMEMFUNC_P (type) && TYPE_PTRMEMFUNC_P (intype)))
return fold_if_not_in_template (build_nop (type, expr));
- else if ((TYPE_PTRMEM_P (type) && TYPE_PTRMEM_P (intype))
+ else if ((TYPE_PTRDATAMEM_P (type) && TYPE_PTRDATAMEM_P (intype))
|| (TYPE_PTROBV_P (type) && TYPE_PTROBV_P (intype)))
{
tree sexpr = expr;
@@ -6460,7 +6459,7 @@ build_const_cast_1 (tree dst_type, tree expr, tsubst_flags_t complain,
if (valid_p)
*valid_p = false;
- if (!POINTER_TYPE_P (dst_type) && !TYPE_PTRMEM_P (dst_type))
+ if (!POINTER_TYPE_P (dst_type) && !TYPE_PTRDATAMEM_P (dst_type))
{
if (complain & tf_error)
error ("invalid use of const_cast with type %qT, "
@@ -6530,7 +6529,7 @@ build_const_cast_1 (tree dst_type, tree expr, tsubst_flags_t complain,
return error_mark_node;
}
- if (TYPE_PTR_P (src_type) || TYPE_PTRMEM_P (src_type))
+ if (TYPE_PTR_P (src_type) || TYPE_PTRDATAMEM_P (src_type))
{
if (comp_ptr_ttypes_const (dst_type, src_type))
{
@@ -8191,7 +8190,7 @@ comp_ptr_ttypes_real (tree to, tree from, int constp)
if (TREE_CODE (to) == VECTOR_TYPE)
is_opaque_pointer = vector_targets_convertible_p (to, from);
- if (TREE_CODE (to) != POINTER_TYPE && !TYPE_PTRMEM_P (to))
+ if (TREE_CODE (to) != POINTER_TYPE && !TYPE_PTRDATAMEM_P (to))
return ((constp >= 0 || to_more_cv_qualified)
&& (is_opaque_pointer
|| same_type_ignoring_top_level_qualifiers_p (to, from)));
@@ -8460,8 +8459,8 @@ casts_away_constness_r (tree *t1, tree *t2, tsubst_flags_t complain)
to
Tcv2,(M-K+1) * cv2,(M-K+2) * ... cv2,M *. */
- if ((!TYPE_PTR_P (*t1) && !TYPE_PTRMEM_P (*t1))
- || (!TYPE_PTR_P (*t2) && !TYPE_PTRMEM_P (*t2)))
+ if ((!TYPE_PTR_P (*t1) && !TYPE_PTRDATAMEM_P (*t1))
+ || (!TYPE_PTR_P (*t2) && !TYPE_PTRDATAMEM_P (*t2)))
{
*t1 = cp_build_qualified_type (void_type_node,
cp_type_quals (*t1));
@@ -8473,11 +8472,11 @@ casts_away_constness_r (tree *t1, tree *t2, tsubst_flags_t complain)
quals1 = cp_type_quals (*t1);
quals2 = cp_type_quals (*t2);
- if (TYPE_PTRMEM_P (*t1))
+ if (TYPE_PTRDATAMEM_P (*t1))
*t1 = TYPE_PTRMEM_POINTED_TO_TYPE (*t1);
else
*t1 = TREE_TYPE (*t1);
- if (TYPE_PTRMEM_P (*t2))
+ if (TYPE_PTRDATAMEM_P (*t2))
*t2 = TYPE_PTRMEM_POINTED_TO_TYPE (*t2);
else
*t2 = TREE_TYPE (*t2);
@@ -8514,7 +8513,7 @@ casts_away_constness (tree t1, tree t2, tsubst_flags_t complain)
complain);
}
- if (TYPE_PTRMEM_P (t1) && TYPE_PTRMEM_P (t2))
+ if (TYPE_PTRDATAMEM_P (t1) && TYPE_PTRDATAMEM_P (t2))
/* [expr.const.cast]
Casting from an rvalue of type "pointer to data member of X
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index b26723f5ea3..c942c0f1cfc 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -1573,7 +1573,7 @@ build_m_component_ref (tree datum, tree component, tsubst_flags_t complain)
component = mark_rvalue_use (component);
ptrmem_type = TREE_TYPE (component);
- if (!TYPE_PTR_TO_MEMBER_P (ptrmem_type))
+ if (!TYPE_PTRMEM_P (ptrmem_type))
{
if (complain & tf_error)
error ("%qE cannot be used as a member pointer, since it is of "
@@ -1615,7 +1615,7 @@ build_m_component_ref (tree datum, tree component, tsubst_flags_t complain)
return error_mark_node;
}
- if (TYPE_PTRMEM_P (ptrmem_type))
+ if (TYPE_PTRDATAMEM_P (ptrmem_type))
{
bool is_lval = real_lvalue_p (datum);
tree ptype;