1. No, it denotes the global foo()
. In main
you are redeclaring the name, not defining it. If there were another definition of foo
, then it would violated One Definition Rule, and the program would not compile.
2. I guess the first answer also answers this. There is only one definition of foo()
, which is in global scope. So unqualified name lookup will refer that one.
EDIT
In the later example, you are defining a
in main
, which hides the global a
. From your first quote:
A declaration is a definition unless it declares a function without specifying the function’s body
a
is not a function, so the declaration is also a definition, which hides the previous definition of a
.