------- Comment #5 from mmitchel at gcc dot gnu dot org  2007-07-08 22:40 
-------
Simon --

It took me a while to decide that this patch was OK -- but it is. :-)  I will
suggest a few changes to make it more obviously correct.

First, minor coding style nit: drop the else after the return that you've
introduced.

Second, we need some chapter-and-verse in here.  Please avoid references like
"11.4.8" as the numbers tend to move around as the standard changes.  (For
example, I don't think 11.4.8 is the right reference in either the published
standard or the current WP.) 

For the comment on the gcc_asert, I would say:

/* A non namespace-scope binding can only be hidden if we
   are in a local class, due to friend declarations.  In particular,
   consider:

     void f() { 
      struct A { 
        friend struct B; 
        void g() { B* b; } // error: B is hidden
      } 
      struct B {};
     }

   The standard says that "B" is a local class in "f" (but not nested within
   "A") -- but that name lookup for "B" does not find this declaration until
   it is declared directly with "f".

   In particular:

   [class.friend]

   If a friend declaration appears in a local class and the name specified
   is an unqualified name, a prior declaration is looked up without considering 
   scopes that are outside the innermost enclosing non-class scope....
   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.
*/

OK with that change.

Thanks,

-- Mark


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simartin at users dot
                   |                            |sourceforge dot net


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

Reply via email to