14.6.2 Dependent Names
The Visual C++ compiler does not currently support binding nondependent names when initially parsing a template. This can cause overloads to be declared after the template (but before the template is instantiated) to be seen.
// DependentNames.cpp
#include <stdio.h>
namespace N {
void f(int) { printf("f(int)\n");}
}
template <class T> void g(T) {
N::f('a'); // calls f(char) should call f(int)
}
namespace N {
void f(char) { printf_s("f(char)\n");}
}
int main() {
g('c');
}
Output
f(char)