Hi,
earlier today noticed three spots where we don't use the existing
INDIRECT_REF_P predicate. I think the patch qualifies as obvious, and
I'm going to apply it later today.
Thanks,
Paolo.
/////////////////////////
2013-08-21 Paolo Carlini <paolo.carl...@oracle.com>
* call.c (build_new_method_call_1): Use INDIRECT_REF_P.
* cp-tree.h (REFERENCE_REF_P): Likewise.
* semantics.c (finish_offsetof): Likewise.
Index: cp/call.c
===================================================================
--- cp/call.c (revision 201902)
+++ cp/call.c (working copy)
@@ -7668,7 +7668,7 @@ build_new_method_call_1 (tree instance, tree fns,
if (init)
{
- if (TREE_CODE (instance) == INDIRECT_REF
+ if (INDIRECT_REF_P (instance)
&& integer_zerop (TREE_OPERAND (instance, 0)))
return get_target_expr_sfinae (init, complain);
init = build2 (INIT_EXPR, TREE_TYPE (instance), instance, init);
Index: cp/cp-tree.h
===================================================================
--- cp/cp-tree.h (revision 201902)
+++ cp/cp-tree.h (working copy)
@@ -2975,7 +2975,7 @@ extern void decl_shadowed_for_var_insert (tree, tr
/* True if NODE is an implicit INDIRECT_EXPR from convert_from_reference. */
#define REFERENCE_REF_P(NODE) \
- (TREE_CODE (NODE) == INDIRECT_REF \
+ (INDIRECT_REF_P (NODE) \
&& TREE_TYPE (TREE_OPERAND (NODE, 0)) \
&& (TREE_CODE (TREE_TYPE (TREE_OPERAND ((NODE), 0))) \
== REFERENCE_TYPE))
Index: cp/semantics.c
===================================================================
--- cp/semantics.c (revision 201902)
+++ cp/semantics.c (working copy)
@@ -3691,7 +3693,7 @@ finish_offsetof (tree expr)
|| TREE_CODE (TREE_TYPE (expr)) == METHOD_TYPE
|| TREE_TYPE (expr) == unknown_type_node)
{
- if (TREE_CODE (expr) == INDIRECT_REF)
+ if (INDIRECT_REF_P (expr))
error ("second operand of %<offsetof%> is neither a single "
"identifier nor a sequence of member accesses and "
"array references");