Bug 84837 - [DR 1906] unqualified lookup in friend declaration
Summary: [DR 1906] unqualified lookup in friend declaration
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 8.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: c++-friends, cxxfriends c++-core-issues
  Show dependency treegraph
 
Reported: 2018-03-12 20:19 UTC by Nathan Sidwell
Modified: 2024-03-25 23:49 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
example (181 bytes, text/plain)
2018-03-12 20:19 UTC, Nathan Sidwell
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nathan Sidwell 2018-03-12 20:19:07 UTC
Created attachment 43635 [details]
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.
Comment 1 Nathan Sidwell 2018-03-12 20:47:13 UTC
I forgot the link to DR1906, which is now determined to be NAD

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1906