This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ PATCH for c++/9342


Another case of failing to build a copy constructor call because we assumed
that all class rvalues were TARGET_EXPRs.  Tested i686-pc-linux-gnu,
applied to 3.3 and trunk.  Test in g++.dg/init/copy4.C.

2003-01-17  Jason Merrill  <jason@redhat.com>

	PR c++/9342
	* call.c (build_conditional_expr): Always do lvalue-rvalue
	conversion.

*** call.c.~1~	Fri Jan 17 14:44:50 2003
--- call.c	Fri Jan 17 14:30:43 2003
*************** build_conditional_expr (tree arg1, tree 
*** 3187,3200 ****
       We use ocp_convert rather than build_user_type_conversion because the
       latter returns NULL_TREE on failure, while the former gives an error.  */
  
!   if (IS_AGGR_TYPE (TREE_TYPE (arg2)) && real_lvalue_p (arg2))
      arg2 = ocp_convert (TREE_TYPE (arg2), arg2,
  			CONV_IMPLICIT|CONV_FORCE_TEMP, LOOKUP_NORMAL);
    else
      arg2 = decay_conversion (arg2);
    arg2_type = TREE_TYPE (arg2);
  
!   if (IS_AGGR_TYPE (TREE_TYPE (arg3)) && real_lvalue_p (arg3))
      arg3 = ocp_convert (TREE_TYPE (arg3), arg3,
  			CONV_IMPLICIT|CONV_FORCE_TEMP, LOOKUP_NORMAL);
    else
--- 3187,3200 ----
       We use ocp_convert rather than build_user_type_conversion because the
       latter returns NULL_TREE on failure, while the former gives an error.  */
  
!   if (IS_AGGR_TYPE (TREE_TYPE (arg2)))
      arg2 = ocp_convert (TREE_TYPE (arg2), arg2,
  			CONV_IMPLICIT|CONV_FORCE_TEMP, LOOKUP_NORMAL);
    else
      arg2 = decay_conversion (arg2);
    arg2_type = TREE_TYPE (arg2);
  
!   if (IS_AGGR_TYPE (TREE_TYPE (arg3)))
      arg3 = ocp_convert (TREE_TYPE (arg3), arg3,
  			CONV_IMPLICIT|CONV_FORCE_TEMP, LOOKUP_NORMAL);
    else

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]