This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
(C++) patch for casts to cv-qualified class type
- To: egcs-patches at cygnus dot com
- Subject: (C++) patch for casts to cv-qualified class type
- From: Jason Merrill <jason at cygnus dot com>
- Date: Thu, 20 May 1999 12:15:51 -0700
We were failing to propagate the cv-quals to the TARGET_EXPR. Fixes
g++.other/overcnv2.C.
1999-05-20 Jason Merrill <jason@yorick.cygnus.com>
* tree.c (lvalue_p_1): A NOP_EXPR can be an lvalue.
(build_cplus_new): Make sure that what we return is of the right type.
Index: tree.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/tree.c,v
retrieving revision 1.113
diff -c -p -r1.113 tree.c
*** tree.c 1999/05/20 10:44:42 1.113
--- tree.c 1999/05/20 19:15:01
*************** lvalue_p_1 (ref, treat_class_rvalues_as_
*** 71,76 ****
--- 71,77 ----
case WITH_CLEANUP_EXPR:
case REALPART_EXPR:
case IMAGPART_EXPR:
+ case NOP_EXPR:
return lvalue_p_1 (TREE_OPERAND (ref, 0),
treat_class_rvalues_as_lvalues);
*************** build_cplus_new (type, init)
*** 193,199 ****
tree rval;
if (TREE_CODE (init) != CALL_EXPR && TREE_CODE (init) != AGGR_INIT_EXPR)
! return init;
slot = build (VAR_DECL, type);
DECL_ARTIFICIAL (slot) = 1;
--- 194,200 ----
tree rval;
if (TREE_CODE (init) != CALL_EXPR && TREE_CODE (init) != AGGR_INIT_EXPR)
! return convert (type, init);
slot = build (VAR_DECL, type);
DECL_ARTIFICIAL (slot) = 1;