-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Full name of submitter (unless configured in github; will be published with the issue): Tim Song
Reference (section label): [basic.lookup.argdep]
Link to reflector thread (if any):
Issue description:
(From this StackOverflow question.)
Since P1787R6, [basic.lookup.argdep]/4.2 says that "Argument-dependent lookup finds all declarations of functions and function templates that [...] are declared as a friend of any class with a reachable definition in the set of associated entities". This notably omits the limitation that the said friends are members of one of the associated namespaces (or, for that matter, are members of namespaces instead of classes).
struct A;
namespace ns { int f(A&&); }
struct A {
friend int ns::f(A&&);
};
int x = f(A{});There is implementation divergence in the handling of this example (GCC trunk accepts with -std=c++20 since this commit; others reject).
The author of P1787R6 confirmed that no change in behavior was intended.
See also CWG143.
Suggested resolution: