------- Additional Comments From gcc-bugzilla at gcc dot gnu dot org  
2005-06-09 16:11 -------
Subject:  class friend declaration doesn't allow use in class scope


------- Additional Comments From lerdsuwa at gcc dot gnu dot org  2005-06-09 
13:58 -------
Not a bug.  The clause you referred to:

  "A name nominated by a friend declaration shall be accessible in the scope of 
  the class containing the friend declaration."

actually means that the following code is not allowed:

  class A { class B {}; };
  class C {
    friend class A::B; // Error - A::B is not accessible inside C
  };

For your case, look at 11.4 paragraph 9:

  "For a friend class declaration, if there is no prior declaration, the class
that is specified
  belongs to the innermost enclosing non-class scope, but if it is subsequently
referenced,
  its name is not found by name lookup until a matching declaration is provided
in the innermost
  enclosing nonclass scope."





-- 


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

Reply via email to