From -6835542686960322223
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,7961205d5764d0b
X-Google-Attributes: gidf78e5,public
From: AllanW@my-dejanews.com
Subject: Re: A suspect bug in Visual C++
Date: 1998/12/01
Message-ID: <73vhoq$anq$1@nnrp1.dejanews.com>#1/1
X-Deja-AN: 417435372
X-NNTP-Posting-Host: 199.125.171.8
Approved: stephen.clamage@sun.com (comp.std.c++)
References: <8767c1s375.fsf@pot.cnuce.cnr.it> <GqF0WmAxWJY2Ewyw@robinton.demon.co.uk> <p6q7lwekzwd.fsf@pandora.inst-inf-1.hu-berlin.de>
X-Snookums: I love you
X-Http-User-Agent: Mozilla/4.06 [en] (Win95; U)
X-Http-Proxy: 1.0 x4.dejanews.com:80 (Squid/1.1.22) for client 199.125.171.8
Organization: Deja News - The Leader in Internet Discussion
X-Article-Creation-Date: Tue Dec 01 01:46:06 1998 GMT
Newsgroups: comp.std.c++
Originator: clamage@taumet


In article <p6q7lwekzwd.fsf@pandora.inst-inf-1.hu-berlin.de>,
  Martin von Loewis <loewis@informatik.hu-berlin.de> wrote:
>
> Francis Glassborow <francis@robinton.demon.co.uk> writes:
>
> > I think you have to declare friend void f() in both A and B.  Can anyone
> > quote the Standard to justify accepting the code as written?
>
> You don't need access to surrounding classes when defining
> members. [class.access]/6 says:
>
> >> In the definition of a member of a nested class that appears
> >> outside of its class definition, the name of the member may be
> >> qualified by the names of enclosing classes of the member's class
> >> even if these names are private members of their enclosing
> >> classes. [Example:
> >>  class D {
> >>     class E {
> >>       static int m;
> >>     };
> >>  };
> >>  int D::E::m = 1; // OK, no access error on private E
> >> end example]
>
> Otherwise, it seems that you need access to each part of the qualified
> name. Still, the VC++ message is confusing, since it is A::B in the
> original poster's example which cannot be accessed.

You read it wrong! So did I.

[MODERATOR: If possible, please reject my earlier reply. I didn't read
the code properly.]

Inside class A::B, f() was declared as a FRIEND function. And yet the
actual definition of f() wasn't allowed access to a struct which was
defined in A::B.

--
AllanW@my-dejanews.com is a "Spam Magnet" -- never read.
Please reply in USENET only, sorry.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]




