lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Forward-declaring friend classes


From: Vadim Zeitlin
Subject: Re: [lmi] Forward-declaring friend classes
Date: Fri, 16 Dec 2005 20:44:46 +0100

On Fri, 16 Dec 2005 12:21:32 +0000 Greg Chicares <address@hidden> wrote:

GC> Vadim--It surprises me that this was necessary
GC>   
http://cvs.savannah.nongnu.org/viewcvs/lmi/lmi/illustration_document.hpp?rev=1.5
GC> because of C++98 3.4.4/3, which gives the example
GC>   friend struct Glob; // OK: Refers to (as yet) undeclared Glob
GC> but if gcc-4 rejects it then we need to make this harmless change.
GC> 
GC> Did you not encounter similar problems with, say,
GC>   class XmlNotebook [...]
GC>   {
GC>       friend class mvc_test;
GC> ? There are other instances of this same usage, too.

 It is indeed perfectly legal to use "friend struct Glob;". However this
does not mean that "Glob" is now known in the enclsoing scope (although g++
4.1 and IBM xlC are the only compilers I know which really enforce this).
I.e. it's ok to declare it as friend but not use it as a type without a
real (forward) declaration.

 Regards,
VZ





reply via email to

[Prev in Thread] Current Thread [Next in Thread]