diff options
author | Jason Merrill <jason@yorick.cygnus.com> | 1998-02-19 10:05:22 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1998-02-19 05:05:22 -0500 |
commit | 31bcaa204ff12aad6a553a333e0a72c9b5b1111a (patch) | |
tree | a9a875c1afc587aae78e6de72dc1b8878ac5a6dc | |
parent | e62d5b583306f95fdc41d51d56349598e341d30b (diff) | |
download | gcc-31bcaa204ff12aad6a553a333e0a72c9b5b1111a.zip gcc-31bcaa204ff12aad6a553a333e0a72c9b5b1111a.tar.gz gcc-31bcaa204ff12aad6a553a333e0a72c9b5b1111a.tar.bz2 |
cvt.c (cp_convert_to_pointer): Preserve TREE_CONSTANT.
* cvt.c (cp_convert_to_pointer): Preserve TREE_CONSTANT.
* typeck2.c (initializer_constant_valid_p): Allow conversions
between pointers and refrerences.
From-SVN: r18119
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/cvt.c | 7 | ||||
-rw-r--r-- | gcc/cp/typeck2.c | 4 |
3 files changed, 12 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 370d443..6019bf0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +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 diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index 0fdce85..d308805 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -136,11 +136,10 @@ cp_convert_to_pointer (type, expr) { 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) { @@ -282,7 +281,9 @@ cp_convert_to_pointer (type, expr) 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); diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index c460f45..6df358a 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -392,8 +392,8 @@ initializer_constant_valid_p (value, endtype) 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. */ |