http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42356

--- Comment #17 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-10-23 
01:54:17 UTC ---
But for this testcase I don't want to be told overload resolution passed or
failed, I want to be told it's ambiguous, because that's the error in the
testcase that prevents it compiling, and the diagnostic should help fix that
problem.

You say clang's output is nicer, I think you should look again.  Notice there
are 6 overloads:
freeList<bar>f(), freeList<bar>f(U), and freeList<bar>f(U,V),
freeList<baz>f(), freeList<baz>f(U), and freeList<baz>f(U,V),

Clang prints 4 errors (which appear to be duplicates, but actually refer to
freeList<bar> and freeList<baz> but that's not shown).  Why are the other two
overloads not shown?  Why doesn't it mention that the call is ambiguous?
It fails to state the problem, and misleadingly implies overload resolution
failed.

G++ mentions all six and correctly says they're ambiguous.  It would be better
if it said why (name lookup found "newNode" in multiple base classes) as clang
does for this code (which it gets right):

template<class T>
struct A {
template<class U>
  void f(U);
};
struct C : A<void>, A<int> { };

int main() {
  C c;
  c.f<char>();
}

Reply via email to