From c2840dfb8acc1944b5adcb49108ab5cd99bed5e4 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 27 Nov 1997 22:18:28 +0000 Subject: [PATCH] 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 --- gcc/cp/ChangeLog | 3 +++ gcc/cp/typeck.c | 8 +++++--- 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 + * 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 -- 2.30.2