class.c (maybe_warn_about_overly_private_class): Improve error messages for class with only private constructors.

* class.c (maybe_warn_about_overly_private_class): Improve error
	messages for class with only private constructors.

From-SVN: r23111
This commit is contained in:
Mark Mitchell 1998-10-15 11:36:46 +00:00 committed by Mark Mitchell
parent 45869a6cab
commit ce0a595295
2 changed files with 19 additions and 1 deletions

View 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.

View 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++)