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

Adrien Chauve adrien.chauve at gmail.com
Tue Dec 14 13:33:50 PST 2010


Thanks for your response and I'm really sorry to answer so late.

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.

This example compiles without any complain on g++ and I'm going to verify
with VS2010 and intel compiler, but I'm pretty sure it compiles as well
using these compilers.

I'm still not sure why this is not a bug of clang.

Cheers,
Adrien



On Sat, Dec 4, 2010 at 11:28, John McCall <rjmccall at apple.com> wrote:

> On Dec 4, 2010, at 2:12 AM, Adrien Chauve wrote:
> > Thanks for the link, it's exactly what I was searching for.
> >
> > But I'm not sure my example code (ant the example on the page you pointed
> at) is invalid. In case of a function call where at least one argument is a
> template dependant name, the call should not be qualified (cf "C++ Templates
> The Complete Guide" by D. Vandervoorde and N. M. Josuttis, section 9.4.2 pp
> 136-138).
>
> The rule is that (1) if the lookup at definition time doesn't find a class
> member and (2) there's at least one type-dependent argument then (3) we
> can't resolve the call at definition time because we have to do
> argument-dependent lookup during instantiation.  ADL never find class
> members, though.
>
> The bug in gcc is that it also performs unqualified lookup at instantiation
> time and therefore finds class members from previously-dependent base
> classes that it's really not supposed to find.
>
> John.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101214/63df2bca/attachment.html>


More information about the cfe-dev mailing list