Patchwork [C++/doc] PR 55813

login
register
mail settings
Submitter Paolo Carlini
Date Feb. 27, 2013, 7:02 p.m.
Message ID <512E5840.2060004@oracle.com>
Download mbox | patch
Permalink /patch/223683/
State New
Headers show

Comments

Paolo Carlini - Feb. 27, 2013, 7:02 p.m.
Hi,

in this PR submitter notices that in -Wctor-dtor-privacy we also handle 
the case of private member functions which are neither constructors nor 
destructors. Eg, we warn for:

class A {  // warning: all member functions in class 'A' are private
   void f();
};

Thus, minimally, I think we could resolve the PR by extending the 
documentation consistently with the code in 
maybe_warn_about_overly_private_class.

On the other hand, changing the behavior of the warning itself doesn't 
seem a good idea (nobody ever complained, AFAIK). Changing the name of 
the warning itself could make more sense, but then we have the usual 
backward compatibility issues, etc, etc.

Thanks,
Paolo.

///////////////////////////
2013-02-27  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/55813
	* doc/invoke.texi ([-Wctor-dtor-privacy]): Complete.
Jason Merrill - Feb. 27, 2013, 9:53 p.m.
OK.  I suppose we could add a different name as an alias, but it 
probably isn't worth the bother.

Jason

Patch

Index: doc/invoke.texi
===================================================================
--- doc/invoke.texi	(revision 196316)
+++ doc/invoke.texi	(working copy)
@@ -2455,7 +2455,9 @@  union U @{
 @opindex Wno-ctor-dtor-privacy
 Warn when a class seems unusable because all the constructors or
 destructors in that class are private, and it has neither friends nor
-public static member functions.
+public static member functions.  Also warn if there are no non-private
+methods, and there's at least one private member function that isn't
+a constructor or destructor.
 
 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
 @opindex Wdelete-non-virtual-dtor