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

John McCall rjmccall at apple.com
Tue Dec 14 14:01:30 PST 2010


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 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.

g++ and VS have extremely broken template models, although g++ is fixing theirs (and had the less broken model in the first place).  ICC has a very good template model which will reject this, but only if you run it in "strict" mode;  otherwise you're running in a compatibility mode which carefully emulates the broken template models of g++ and VS.  Clang is like ICC except we don't have an intentionally-broken compatibility mode.

John.



More information about the cfe-dev mailing list