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.carl...@oracle.com>
PR c++/55813
* doc/invoke.texi ([-Wctor-dtor-privacy]): Complete.
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