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 to build_over_call for c++/5995


We don't need to suppress copy elision for empty classes if they have a
non-trivial copy constructor, as any copies will be done via said
constructor, which is presumably smart enough not to write on the padding.
Am I missing something?

Tested i686-pc-linux-gnu.  Applied trunk, 3.0 and 3.1.
Fixes g++.other/empty1.C.

2002-03-18  Jason Merrill  <jason@redhat.com>

	PR c++/5995
	* call.c (build_over_call): Fix empty class logic.

*** call.c.~1~	Mon Mar 18 15:36:23 2002
--- call.c	Mon Mar 18 15:35:11 2002
*************** build_over_call (cand, args, flags)
*** 4268,4274 ****
  	          be touched as it might overlay things. When the
  	          gcc core learns about empty classes, we can treat it
  	          like other classes. */
! 	       && !is_empty_class (DECL_CONTEXT (fn)))
  	{
  	  tree address;
  	  tree to = stabilize_reference
--- 4268,4275 ----
  	          be touched as it might overlay things. When the
  	          gcc core learns about empty classes, we can treat it
  	          like other classes. */
! 	       && !(is_empty_class (DECL_CONTEXT (fn))
! 		    && TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn))))
  	{
  	  tree address;
  	  tree to = stabilize_reference

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