Consider the following code:
#include <iostream>
int a=5;//1
extern int a;//2
int main(){ cout << a; }
During unqualified name lookup declaration#1 will be found and unqualified name lookup ends just after #1 is found.
But consider another example:
#include <iostream>
void foo() { cout << "zero arg"; }
void foo(int a) { cout << "one arg"; }
int main(){ foo(4); }
In that case void foo();
's definition will be found first. But unqualified name lookup doesn't end. Why? Where is it specified in the standard? In general, I'm interested in:
When does unqualified name lookup ends for the postfix-expression for the function call?
Note: I know what does ADL mean. The set of declarations produced by ADL is empty in that case.
UPD:
But if we write the following:
int foo(int a) { return 0; }
namespace A
{
int foo() { return 1; }
int a= foo(5); //Error: to many arguments
}
This implies that enclosing namespace does not considering. I would like to know where is it specified too.