This is the mail archive of the gcc-bugs@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]
Other format: [Raw text]

[Bug c++/13935] [3.4/3.5 Regression] Template friend lookup bug


------- Additional Comments From gdr at integrable-solutions dot net  2004-02-02 02:26 -------
Subject: Re:  [3.4/3.5 Regression] Template friend lookup bug

"giovannibajo at libero dot it" <gcc-bugzilla@gcc.gnu.org> writes:

| ------- Additional Comments From giovannibajo at libero dot it  2004-02-02 02:16 -------
| (In reply to comment #5)
| 
| > That is the same thing as for
| >    struct foo { };
| >    struct bar {
| >       foo foo;
| >    };  
| 
| I disagree. [class.friend]/1: "The name of a friend is not in the
| scope of the class."

You're confused:  There is a difference between being in the scope of
the class  and being used in the class definition.   The quote I gave
does not speak of being in the scope of the class, so the paragraph
you quote is irrelevant. 


| > See 3.3.6/1
| >    [...]
| >    2) A name N used in a class S shall refer to the same declaration
| >       in its context and when reevaluated in the completed scope of
| >       S. No diagnostic is required for a violation of this rule.
| 
| 3.3.6 is [basic.class.scope] and 3.3.6/1 begins with: "The following rules 
| describe the scope of names declared in classes". Given [class.friend]/1, I 
| don't see how this could apply.

Note that the paragraph speaks of "name *used*" not name declared, so
your qoute about named declared is irrelevant.  What matters is the
*use* of the names.  Here, in the friend-declaration, the name is used
to grant friendship -- it is not declared; it is *used*.  If
re-evaluation after the completed class-scope gives something different
then bad things can happen.

-- Gaby


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13935


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