This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: local class and scoping
- To: martinb at coyotesystems dot com
- Subject: Re: local class and scoping
- From: "Martin v. Loewis" <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Sun, 21 Nov 1999 22:18:26 +0100
- CC: gcc at gcc dot gnu dot org
- References: <3835AFD4.92E3C91@coyotesystems.com>
> I think I have stumbled on an issue with scoping and local classes. All
> compilation is done on gcc-2.95.2.
Thanks for your bug report.
> a::init::init() {
> sA = 5; // access to static member of enclosing class.
> };
That should not be accepted: a nested class is not automatically
friend of the enclosing class.
> class a {
> public:
> a() {}
> private:
> static int sA;
> class init {
> public:
> init();
> };
If you put
friend class init;
here, g++ will accept it even with qualification.
Hope this helps,
Martin