[cfe-dev] Error name lookup in template dependant base class

John McCall rjmccall at apple.com
Tue Dec 14 14:05:39 PST 2010


On Dec 14, 2010, at 2:01 PM, John McCall wrote:
> On Dec 14, 2010, at 1:33 PM, Adrien Chauve wrote:
>> I don't think the problem is ADL here. The name of the function call is a dependant name, so the unqualified lookup is delayed until instanciation: it's not ADL, it's just delayed ordinary lookup. At instanciation time and when all explicit template specializations are available, lookups can be done in the base class to find members.
> 
> Well, no, they can't.  This is what we're all trying to explain.  The standard is extremely explicit about this:
> 
> C++ [temp.dep.res]p1:
>  In resolving dependent names, names from the following sources are considered:
>  — Declarations that are visible at the point of definition of the template.
>  — Declarations from namespaces associated with the types of the function arguments both from the instantiation context and from the definition context.

This is actually not the part of the standard I meant to quote, although it does apply.  The better quote is [temp.dep.candidate]p1:

  For a function call that depends on a template parameter, the candidate functions are found using the usual lookup rules except that:
  — For the part of the lookup using unqualified name lookup or qualified name lookup, only function declarations from the template definition context are found.
  — For the part of the lookup using associated namespaces, only function declarations found in either the template definition context or the template instantiation context are found.

John.



More information about the cfe-dev mailing list