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: Sun, 23 Oct 2011 01:55:00 -0000	[thread overview]
Message-ID: <bug-42356-4-fhb75S14Bz@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 #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>();
}


  parent reply	other threads:[~2011-10-23  1:55 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
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 [this message]
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-fhb75S14Bz@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).