This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: incorrect warning in 3.0.1 prerelease


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]