For example, GCC and clang both fail to compile the following code:
struct S {};
namespace N
{
void g(S);
}
using N::g;
namespace N
{
void g(int);
}
int main()
{
g(0);
}
with the error:
test.cpp: In function 'int main()':
test.cpp:17:8: error: could not convert '0' from 'int' to 'S'
g(0);
^
suggesting that the using-declaration only imports the overloads declared above the point where the using-declaration appears, not ones that may appear later (but before the use of the name).
Is this behaviour correct?
Yes, this behavior is correct and is well defined as per the c++ standard.
The relevant section is § 7.3.3.11 of C++11 standard: