re PR c++/689 ([diagnostic] this warning is not helpful: `class xxxx' only defines...
authorGabriel Dos Reis <gdr@integrable-solutions.net>
Sun, 11 May 2003 12:47:42 +0000 (12:47 +0000)
committerGabriel Dos Reis <gdr@gcc.gnu.org>
Sun, 11 May 2003 12:47:42 +0000 (12:47 +0000)
PR C++/689
PR C++/9257
* c-opts.c (c_common_decode_option): Don't set
warn_ctor_dtor_privacy wen -Wall.
* c-common.c (warn_ctor_dtor_privacy): Don't turn on by default.

From-SVN: r66684

gcc/ChangeLog
gcc/c-common.c
gcc/c-opts.c
gcc/testsuite/g++.dg/warn/ctor-dtor-privacy-1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/warn/ctor-dtor-privacy-2.C [new file with mode: 0644]

index 9c7020697e7749d2032ee60bb75b2ca46ff722fb..fcfd2f4d282b2922c271923cc7f3011e76cf8a27 100644 (file)
@@ -1,3 +1,11 @@
+2003-05-11  Gabriel Dos Reis  <gdr@integrable-solutions.net>
+
+       PR C++/689
+       PR C++/9257
+       * c-opts.c (c_common_decode_option): Don't set
+       warn_ctor_dtor_privacy wen -Wall.
+       * c-common.c (warn_ctor_dtor_privacy): Don't turn on by default.
+
 2003-05-10  Alexandre Oliva  <aoliva@redhat.com>
 
        * reload1.c (reload_cse_move2add): Revert part of my 2003-05-09's
index aa34d53afcbef57dabee9fb49cefdb2ed0f1aafe..c3fcf42e8d10eea8b8e2b16dc924dba90e758bde 100644 (file)
@@ -626,7 +626,7 @@ int warn_implicit = 1;
 /* Nonzero means warn when all ctors or dtors are private, and the class
    has no friends.  */
 
-int warn_ctor_dtor_privacy = 1;
+int warn_ctor_dtor_privacy = 0;
 
 /* Nonzero means warn in function declared in derived class has the
    same name as a virtual in the base class, but fails to match the
index bbceabbf323681b3ad33c7a5159cc4361500ade5..82cae2e6c9f667f422f54d62ae59553ce9b0db6d 100644 (file)
@@ -825,7 +825,6 @@ c_common_decode_option (argc, argv)
       else
        {
          /* C++-specific warnings.  */
-         warn_ctor_dtor_privacy = on;
          warn_nonvdtor = on;
          warn_reorder = on;
          warn_nontemplate_friend = on;
diff --git a/gcc/testsuite/g++.dg/warn/ctor-dtor-privacy-1.C b/gcc/testsuite/g++.dg/warn/ctor-dtor-privacy-1.C
new file mode 100644 (file)
index 0000000..3e84c09
--- /dev/null
@@ -0,0 +1,9 @@
+// { dg-options "-Wctor-dtor-privacy" }
+
+struct C {                      // { dg-warning "" }
+   static bool result;
+private:
+   static bool check();
+};
+
+bool C::result = check();
diff --git a/gcc/testsuite/g++.dg/warn/ctor-dtor-privacy-2.C b/gcc/testsuite/g++.dg/warn/ctor-dtor-privacy-2.C
new file mode 100644 (file)
index 0000000..16873ab
--- /dev/null
@@ -0,0 +1,7 @@
+struct C {
+   static bool result;
+private:
+   static bool check();
+};
+
+bool C::result = check();