Example in [basic.lookup.argdep]/3:
namespace NS {
class T { };
void f(T);
void g(T, int);
}
NS::T parm;
void g(NS::T, float);
int main() {
f(parm); // OK: calls NS::f
extern void g(NS::T, float);
g(parm, 1); // OK: calls g(NS::T, float)
}
For the call g(parm, 1)
we have in the set X the declaration void g(NS::T, float);
in global scope. AFAICT, we also have in set Y the declaration void g(T, int);
in namespace NS
, an associate namespace of the argument parm
of type NS::T
. Thus, if I'm not wrong, the two declarations are candidates for overload resolution. Then, is it the case that the declaration in global scope is preferred in relation to the one in namespace NS
? Why? I would very much appreciate a quote from the Standard as an answer.