12.7.2. Name Lookup, Templates, and Accessing Members of Base Classes
12.7.2 Name Lookup, Templates, and Accessing Members of Base Classes
The C++ standard prescribes that all names that are not dependent on template parameters are bound to their present definitions when parsing a template function or class.1 Only names that are dependent are looked up at the point of instantiation. For example, consider
void foo(double); struct A { template <typename T> void f () { foo (1); // 1 int i = N; // 2 T t; t.bar(); // 3 foo (t); // 4 } static const int N; };
Here, the names foo
and N
appear in a context that does not depend on the type of T
. The compiler will thu