summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1997-11-27 22:18:28 +0000
committerJason Merrill <jason@gcc.gnu.org>1997-11-27 17:18:28 -0500
commitc2840dfb8acc1944b5adcb49108ab5cd99bed5e4 (patch)
tree6595851c97d1f119b20d54c54eac6a5c8398199a /gcc
parentfb98cff689605cc03070b54c3a234f94dec93fde (diff)
downloadgcc-c2840dfb8acc1944b5adcb49108ab5cd99bed5e4.tar.gz
typeck.c (build_const_cast): Handle references here instead of handing off to convert_to_reference.
* typeck.c (build_const_cast): Handle references here instead of handing off to convert_to_reference. From-SVN: r16810
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/typeck.c8
2 files changed, 8 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 7ab1e62143b..0b1b931332e 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
Thu Nov 27 00:59:46 1997 Jason Merrill <jason@yorick.cygnus.com>
+ * typeck.c (build_const_cast): Handle references here instead of
+ handing off to convert_to_reference.
+
* except.c: Lose Unexpected, SetTerminate, SetUnexpected,
TerminateFunctionCall.
(init_exception_processing): Likewise. Terminate et al are now
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index bd5a43cd9ec..34bbf97016e 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -5488,9 +5488,11 @@ build_const_cast (type, expr)
}
if (comp_ptr_ttypes_const (TREE_TYPE (type), intype))
- return (convert_from_reference
- (convert_to_reference (type, expr, CONV_CONST|CONV_IMPLICIT,
- LOOKUP_COMPLAIN, NULL_TREE)));
+ {
+ expr = build_unary_op (ADDR_EXPR, expr, 0);
+ expr = build1 (NOP_EXPR, type, expr);
+ return convert_from_reference (expr);
+ }
}
else if (TREE_CODE (type) == POINTER_TYPE
&& TREE_CODE (intype) == POINTER_TYPE