It depends on finding dependent names in the template function, for example:
template<class T>
void foo(T const &t)
{
::func(t);
}
In this code, it funcis a dependent name because it has a type-dependent expression as an argument to a function call. In C ++ 11, the search funcwas covered by [temp.dep.candidate] / 1:
To call a function that depends on the template parameter, candidate functions are found using the usual search rules (3.4.1, 3.4.2, 3.4.3), except that:
- For the search part that uses the unqualified name search (3.4.1) or the qualified name search (3.4.3), only function declarations from the template definition context are found.
- For the search part using the associated namespaces (3.4.2), only function declarations found in the context of the template definition or the template creation context were found.
[Note: 3.4.1 is a “normal” search for unqualified identifiers, and 3.4.2 is a search for unqualified identifiers of function names, otherwise. ADL and 3.4.3 are searches with a verified identifier].
However, in C ++ 14 (N3936), parts of the request with identifier verification were deleted:
To call a function where the postfix expression is a dependent name, candidate functions are detected using the usual search rules (3.4.1, 3.4.2), except that:
- For the search part using the unqualified name search (3.4.1), only function declarations from the template definition context were found.
- For the search part using the associated namespaces (3.4.2), only function declarations found in the context of the template definition or the template creation context were found.
, ; - , ?
(: , - , ).