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]

Re: PATCH to avoid copying tail padding (was: GCC 3.2)


For the trunk, just allow this case where it's reasonable to call
expr_size.  Test in g++.dg/init/aggr1.C.

2002-08-31  Jason Merrill  <jason@redhat.com>

	* cp-lang.c (cp_expr_size): Allow initialization from a
	CONSTRUCTOR.

*** cp-lang.c.~1~	Mon Aug 12 11:48:29 2002
--- cp-lang.c	Sat Aug 31 10:52:07 2002
*************** cp_expr_size (exp)
*** 298,304 ****
  	 of a type with both of these set; all copies of such types must go
  	 through a constructor or assignment op.  */
        if (TYPE_HAS_COMPLEX_INIT_REF (TREE_TYPE (exp))
! 	  && TYPE_HAS_COMPLEX_ASSIGN_REF (TREE_TYPE (exp)))
  	abort ();
        /* This would be wrong for a type with virtual bases, but they are
  	 caught by the abort above.  */
--- 298,306 ----
  	 of a type with both of these set; all copies of such types must go
  	 through a constructor or assignment op.  */
        if (TYPE_HAS_COMPLEX_INIT_REF (TREE_TYPE (exp))
! 	  && TYPE_HAS_COMPLEX_ASSIGN_REF (TREE_TYPE (exp))
! 	  /* But storing a CONSTRUCTOR isn't a copy.  */
! 	  && TREE_CODE (exp) != CONSTRUCTOR)
  	abort ();
        /* This would be wrong for a type with virtual bases, but they are
  	 caught by the abort above.  */

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