https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84837

            Bug ID: 84837
           Summary: unqualified lookup in friend declaration
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nathan at gcc dot gnu.org
  Target Milestone: ---

Created attachment 43635
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43635&action=edit
example

in a friend declaration of the form
class B::Y {
  friend int A::X::f (type);
}
(A & B are namespaces or enclosing classes).  what scopes are searched for
type?

[basic.lookup.unqual]p10, tells us we should search
  class A::X as for member lookup, then if not found perform an unqualified
lookup in the current scope -- that is B::Y, B, ::

We instead search A::X then B::Y then A then ::.

Other compilers also get this wrong in different ways.

The example fails to compile because we find non-types in scopes we should not
have searched.

Reply via email to