public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/42356] improve list of candidates and error recovery for ambiguous call
Date: Sat, 22 Oct 2011 13:08:00 -0000	[thread overview]
Message-ID: <bug-42356-4-QdNdPhjkAI@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-42356-4@http.gcc.gnu.org/bugzilla/>

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!)


  parent reply	other threads:[~2011-10-22 13:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-42356-4@http.gcc.gnu.org/bugzilla/>
2011-09-28 21:28 ` [Bug c++/42356] confused compiler paolo.carlini at oracle dot com
2011-10-22 12:27 ` manu at gcc dot gnu.org
2011-10-22 12:29 ` [Bug c++/42356] improve list of candidates and error recovery for ambiguous call manu at gcc dot gnu.org
2011-10-22 13:01 ` redi at gcc dot gnu.org
2011-10-22 13:08 ` redi at gcc dot gnu.org [this message]
2011-10-22 13:21 ` redi at gcc dot gnu.org
2011-10-22 13:30 ` manu at gcc dot gnu.org
2011-10-22 15:53 ` igodard at pacbell dot net
2011-10-22 19:43 ` redi at gcc dot gnu.org
2011-10-23  0:46 ` manu at gcc dot gnu.org
2011-10-23  0:47 ` manu at gcc dot gnu.org
2011-10-23  1:29 ` igodard at pacbell dot net
2011-10-23  1:55 ` redi at gcc dot gnu.org
2011-10-23  2:04 ` redi at gcc dot gnu.org
2021-09-07 18:21 ` pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-42356-4-QdNdPhjkAI@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).