On 05.07.2016 20:22, Stephan T. Lavavej wrote:
"In resolving dependent names, names from the following sources are considered: (1.1) - Declarations that are visible at the point of definition of the template. (1.2) - Declarations from namespaces associated with the types of the function arguments both from the instantiation context (14.6.4.1) and from the definition context."
Here, 1.1 means that f(int) is visible when g() is defined, while f(double) has not yet been seen.
1.2 has the ability to see things that are declared after g()'s definition, BUT it is restricted to "associated namespaces" (like what's considered for ADL). Here, 3.14 is a double and has no associated namespaces, so nothing extra is considered.
It isn't clear to me why the "global namespace" together with built-in (and other globally defined) types isn't considered the same way as any named namespace with the types defined inside it. At least, such a reading of the standard would resolve the above and remove the special treatment the global namespace gets in your interpretation.
(It took me a long time to understand these rules, and I still don't have a very good intuition for them.)
STL
Thanks, Stefan -- ...ich hab' noch einen Koffer in Berlin...