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

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-10-22 
13:07:50 UTC ---
(In reply to comment #8)
> That might be an improvement, yes.  That's the only issue I see here.

Actually, there is another issue in the list of candidates:

template<class U> T* freeList::newNode(U) [with U = U, T = baz]
T* freeList<T>::newNode() [with T = baz]

The first one should say freeList<T> not freeList.

That would help realise that the member name has been found in two classes.

With -fno-pretty-templates it's better:

f.C:17:17: error: request for member ‘newNode’ is ambiguous
f.C:8:15: error: candidates are: template<class U, class V> baz*
freeList<baz>::newNode<U, V>(U, V)
f.C:6:15: error:                 template<class U> baz*
freeList<baz>::newNode<U>(U)
f.C:4:13: error:                 baz* freeList<baz>::newNode()
f.C:8:15: error:                 template<class U, class V> bar*
freeList<bar>::newNode<U, V>(U, V)
f.C:6:15: error:                 template<class U> bar*
freeList<bar>::newNode<U>(U)
f.C:4:13: error:                 bar* freeList<bar>::newNode()

This makes it easier to see that name lookup found these functions:
  freeList<baz>::newNode(U, V)
  freeList<baz>::newNode(U)
  freeList<bar>::newNode(U,V)
  freeList<bar>::newNode(U)
so you can see they come from different scopes (it would be even clearer if
"bar" and "baz" weren't visually very similar!)

Reply via email to