When I try to compile this code
// void foobar(int);
template
struct Foo {
void bar(T t) { foobar(t); };
};
void foobar(int);
template clas
Phase two lookup only includes name lookup rules that can't be applied in phase one- ADL, for example. Two-phase lookup is exactly that- some names are looked up in phase one, and some are looked up in phase two. This particular kind of name is a phase one name, as the compiler is perfectly capable of looking for foobar
in the namespace(s) of the function during phase one.
Visual C++ does not implement two-phase name lookup.