class.c (maybe_warn_about_overly_private_class): Improve error messages for class...
authorMark Mitchell <mark@markmitchell.com>
Thu, 15 Oct 1998 11:36:46 +0000 (11:36 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Thu, 15 Oct 1998 11:36:46 +0000 (11:36 +0000)
* class.c (maybe_warn_about_overly_private_class): Improve error
messages for class with only private constructors.

From-SVN: r23111

gcc/cp/ChangeLog
gcc/cp/class.c

index b98eb82..6b6ed2c 100644 (file)
@@ -1,3 +1,15 @@
+1998-10-15  Mark Mitchell  <mark@markmitchell.com>
+
+       * class.c (maybe_warn_about_overly_private_class): Improve error
+       messages for class with only private constructors.
+
+       * cp-tree.def (TYPENAME_TYPE): Add to documentation.
+       * cp-tree.h (TYPENAME_TYPE_FULLNAME): Document.
+       (build_typename_type): New function.
+       * decl.c (build_typename_type): Broken out from ...
+       (make_typename_type): Use it.
+       * search.c (lookup_field): Likewise.
+
 1998-10-14 Benjamin Kosnik  <bkoz@rhino.cygnus.com>
 
        * pt.c (convert_nontype_argument): Check against type_referred_to.
index cd16b59..d440e7c 100644 (file)
@@ -2013,12 +2013,18 @@ maybe_warn_about_overly_private_class (t)
            has_nonprivate_method = 1;
            break;
          }
-       else
+       else if (!DECL_CONSTRUCTOR_P (fn) && !DECL_DESTRUCTOR_P (fn))
          has_member_fn = 1;
       } 
 
   if (!has_nonprivate_method && has_member_fn) 
     {
+      /* There are no non-private methods, and there's at least one
+        private member function that isn't a constructor or
+        destructor.  (If all the private members are
+        constructors/destructors we want to use the code below that
+        issues error messages specifically referring to
+        constructors/destructors.)  */
       int i;
       tree binfos = BINFO_BASETYPES (TYPE_BINFO (t));
       for (i = 0; i < CLASSTYPE_N_BASECLASSES (t); i++)