This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: incorrect warning in 3.0.1 prerelease
- To: gcc at gcc dot gnu dot org
- Subject: Re: incorrect warning in 3.0.1 prerelease
- From: Michael Price <mprice at atl dot lmco dot com>
- Date: Fri, 3 Aug 2001 10:42:06 -0400
- Cc: gcc-bugs at gcc dot gnu dot org
- References: <20010802165053.A908@atl.lmco.com>
The warning problem I emailed you about yesterday only occurs if the static
methods are listed AFTER the constructors and destructors in the class
definition. If they are listed BEFORE the constructors and destructors then
the warning isn't displayed.
Michael
On Thu, Aug 02, 2001 at 04:50:53PM -0400, Michael Price wrote:
> gcc version 3.0.1 (prerelease) give the following warning:
>
> warning: `class Bar' only defines private constructors and has no friends
>
> even when class Bar has public static methods. The result is that a proper
> singleton gets the warning when it shouldn't.
>
> The maybe_warn_about_overly_private_class(t) function in cp/class.c admits
> that:
>
> /* A non-private static member function is just like a
> friend; it can create and invoke private member
> functions, and be accessed without a class
> instance. */
>
> and even has a `if (DECL_STATIC_FUNCTION_P (fn))' but the warning is
> displayed anyway.
>
> Just letting you know.
>
> Michael
--
Michael Price
Distributed Processing Lab; Lockheed Martin Adv. Tech. Labs
A&E 3W; 1 Federal Street; Camden, NJ 08102
856-338-4021, fax 856-338-4144 email: mprice@atl.lmco.com