This 2-phase look up of g++ (gnu C++) seems not inconsistency: builtin types are not treat equivalent with user defined type.
#include <stdio.h>
class A {}; void f(A) { printf("%s\n", __PRETTY_FUNCTION__); }
class B {};
// now g(T) knew A,B,int,...
// phase 1 lookup just success for f(A)
template<class T> void g(T x) { f(x); }
// after definition of g(T) and class B
void f(B) { printf("%s\n", __PRETTY_FUNCTION__); }
void f(int x) { printf("%s\n", __PRETTY_FUNCTION__); }
void f(int*x) { printf("%s\n", __PRETTY_FUNCTION__); }
int main(int argc, char** argv) {
g(A()); // should always(phase 1 and phase 2) be OK
g(B()); // f(B) definition is after g(T) definition, phase 1 just got f(A)
g(B()); // but phase 2 got f(B)
g(100); // intend to let g calling f(int), but failed in g++ 4.1 or newer
g(&argc); // intention: similar as g(100)
return 0;
}