[cfe-dev] Explaining unqualified lookup in templates

Bruce Merry bmerry at gmail.com
Wed Apr 4 10:40:04 PDT 2012


On 4 April 2012 19:35, Richard Smith <richard at metafoo.co.uk> wrote:
> Notionally, yes, name lookup occurs at the point of instantiation. But that
> doesn't mean that name lookup finds names which have been declared since the
> template was defined. The relevant section is 14.6.4.2:
>
> "For a function call that depends on a template parameter, the candidate
> functions are found using the usual
> lookup rules (3.4.1, 3.4.2, 3.4.3) except that:
> — For the part of the lookup using unqualified name lookup (3.4.1) or
> qualified name lookup (3.4.3), only
> function declarations from the template definition context are found.
> — For the part of the lookup using associated namespaces (3.4.2), only
> function declarations found in
> either the template definition context or the template instantiation context
> are found."

Thanks, that's the piece of the puzzle I was missing.

Cheers
Bruce
-- 
Dr Bruce Merry
bmerry <@> gmail <.> com
http://www.brucemerry.org.za/
http://blog.brucemerry.org.za/




More information about the cfe-dev mailing list