* cvt.c (cp_convert_to_pointer): Preserve TREE_CONSTANT.
* typeck2.c (initializer_constant_valid_p): Allow conversions
between pointers and refrerences.
From-SVN: r18119
+Thu Feb 19 10:04:12 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * cvt.c (cp_convert_to_pointer): Preserve TREE_CONSTANT.
+ * typeck2.c (initializer_constant_valid_p): Allow conversions
+ between pointers and refrerences.
+
1998-02-19 Brendan Kehoe <brendan@cygnus.com>
* typeck.c (build_unary_op): Only warn about incr/decr a pointer
{
register tree intype = TREE_TYPE (expr);
register enum tree_code form;
+ tree rval;
if (IS_AGGR_TYPE (intype))
{
- tree rval;
-
intype = complete_type (intype);
if (TYPE_SIZE (intype) == NULL_TREE)
{
return error_mark_node;
}
- return build1 (NOP_EXPR, type, expr);
+ rval = build1 (NOP_EXPR, type, expr);
+ TREE_CONSTANT (rval) = TREE_CONSTANT (expr);
+ return rval;
}
my_friendly_assert (form != OFFSET_TYPE, 186);
case CONVERT_EXPR:
case NOP_EXPR:
/* Allow conversions between pointer types. */
- if (TREE_CODE (TREE_TYPE (value)) == POINTER_TYPE
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (value, 0))) == POINTER_TYPE)
+ if (POINTER_TYPE_P (TREE_TYPE (value))
+ && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (value, 0))))
return initializer_constant_valid_p (TREE_OPERAND (value, 0), endtype);
/* Allow conversions between real types. */