This is the statement from ISO C++ Standard 14.6.4.1 Point of instantiation
4.If a virtual function is implicitly instantiated, its point of instantiation
is
The first two statements explain where the instantiation point of certain template constructs are; it doesn't introduce new template constructs. So you can reuse your previous examples.
The third statement (14.6.4.1/6) tells us what the point of instantiation points is: they are the point where names are looked up during the second phase of name lookup. Names that are declared before the instantiation point are visible; those declared afterwards are not. (In the first phase of two-phase name lookup, non-dependent names are looked up in the set of declarations that precede the template definition).
So, given:
template void foo() {
T() + T();
}
the instantiation contexts of the expression T()+T()
is the set of declarations that precede the respective instantiation points of foo
. The name operator+
is looked up in those contexts, and includes declarations that follow this definition but precede the instantiation point.