[LLVMbugs] [Bug 6553] Difference between clang and g++ in lookup of methods of template base classes
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Mar 9 13:23:22 PST 2010
http://llvm.org/bugs/show_bug.cgi?id=6553
Douglas Gregor <dgregor at apple.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
--- Comment #4 from Douglas Gregor <dgregor at apple.com> 2010-03-09 15:23:22 CST ---
(In reply to comment #3)
> (In reply to comment #2)
> > (In reply to comment #0)
> > > The folowing code compiles fine with g++, clang++ wants fooNum to be qualified
> > > (Foo<T>::fooNum).
> > >
> >
> > In [temp.dep] (14.7.2 in n3000), it says:
> >
> > In an expression of the form:
> >
> > postfix-expression ( expression-listopt )
> >
> > where the postfix-expression is an unqualified-id but not a template-id,
> > the unqualified-id denotes a dependent name if and only if any of the
> > expressions in the expression-list is a type-dependent expression
> > (14.7.2.2).
> >
> > 14.6.2 in C++03 has similar wording.
> >
> > My interpretation of that is that "getNum()" is not dependant, since the empty
> > expression list is not type-dependent, and thus "fooNum(getNum())" is also not
> > dependant, since its expression list isn't type-dependent.
>
> I don't think the issue is either of these expressions being dependent (and I
> agree getNum() is clearly fine), it's that the base class is dependent. That
> means an unqualified name cannot look into the base class and find a member
> function. I would expect the fix to be calling "this->fooNum(getNum())" to
> clarify that this is a member function call (as opposed to calling a function
> at namespace scope). Perhaps there is something that makes this case special
> that I'm missing though.
Chandler is correct. fooNum() in the base class is not visible, and since
getNum() is not type-dependent , fooNum is not a dependent name. GCC is wrong
to permit this code.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list