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]

PATCH Re: remove C++ warning about all private c/dtors and nofriends?


It turns out that the code for the warning already tried to handle this
case, but failed due to a bug.  The fix is simple, so I've made it rather
than remove the warning entirely.

Test in g++.dg/warn/private1.C.  Tested i686-pc-linux-gnu, applied to 3.3
and trunk.

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

	* class.c (maybe_warn_about_overly_private_class): Don't stop
	searching when we find a nonprivate method.

*** class.c.~1~	Sun Jan 12 22:55:58 2003
--- class.c	Sun Jan 12 22:51:24 2003
*************** maybe_warn_about_overly_private_class (t
*** 1833,1839 ****
  	      return;
  		
  	    has_nonprivate_method = 1;
! 	    break;
  	  }
  	else if (!DECL_CONSTRUCTOR_P (fn) && !DECL_DESTRUCTOR_P (fn))
  	  has_member_fn = 1;
--- 1835,1841 ----
  	      return;
  		
  	    has_nonprivate_method = 1;
! 	    /* Keep searching for a static member function.  */
  	  }
  	else if (!DECL_CONSTRUCTOR_P (fn) && !DECL_DESTRUCTOR_P (fn))
  	  has_member_fn = 1;

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