public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: reichelt@igpm.rwth-aachen.de
To: dunkel@Synopsys.COM, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
	nobody@gcc.gnu.org
Subject: Re: c++/9315: [3.2/3.3/3.4 regression] problems with overload resolution
Date: Thu, 16 Jan 2003 09:55:00 -0000	[thread overview]
Message-ID: <20030116095547.30684.qmail@sources.redhat.com> (raw)

Old Synopsis: g++ doesn't create any code for this testcase
New Synopsis: [3.2/3.3/3.4 regression] problems with overload resolution

State-Changed-From-To: open->analyzed
State-Changed-By: reichelt
State-Changed-When: Thu Jan 16 01:55:45 2003
State-Changed-Why:
    Confirmed (sort of).
    
    First of all, the message I get is:
    
    testcase2.cxx: In function `int testcase()':
    testcase2.cxx:12: choosing `void operator+(const fix&, double)' over `operator+'
    testcase2.cxx:12:   because worst conversion for the former is better than 
       worst conversion for the latter
    
    That's not a warning, but an error message (a warning would have the word
    "warning" in front of the messages).
    And that's why no object file is generated.
    
    BTW, with gcc 3.3 you cannot confuse errors with warnings any more:
    
    testcase2.cxx: In function `int testcase()':
    testcase2.cxx:12: error: choosing `void operator+(const fix&, double)' over `
       operator+'
    testcase2.cxx:12: error:   because worst conversion for the former is better 
       than worst conversion for the latter
    
    Some questions, however remain:
    Why is that an error and not a warning? At least the wording is strange,
    since the compiler told the user what was done to resolve a problem. 
    If I specify "-pedantic" I get the following message, which is what I
    would expect from an error message (well, almost - the last two lines are
    redundant and could use some clean-up):
    
    testcase2.cxx: In function `int testcase()':
    testcase2.cxx:12: ambiguous overload for `fix& + float&' operator
    testcase2.cxx:12: candidates are: operator+(double, float) <built-in>
    testcase2.cxx:4:                 void operator+(const fix&, double)
    testcase2.cxx:4:                 void operator+(const fix&, double)
    
    In gcc 2.95.3 the situation is handled differently:
    Without "-pedantic" the code compiles (without warning).
    With "-pedantic" we get a similer error message (without the duplicate line):
    
    testcase2.cxx: In function `int testcase()':
    testcase2.cxx:12: ambiguous overload for `fix & + float &'
    testcase2.cxx:12: candidates are: operator +(double, float) <builtin>
    testcase2.cxx:4:                 void operator +(const fix &, double)
    
    To summarize, I would suggest the following:
    * Decide whether the code should compile without "-pedantic" or not.
      If yes, make the error a warning - if no, use the same error message
      as with "-pedantic".
    * Remove the duplicate line in the "-pedantic" error message.
    
    Since the situation is more confusing than in gcc 2.95.3 I rate this
    as a regression.
    
    Regards,
    Volker

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9315


             reply	other threads:[~2003-01-16  9:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-16  9:55 reichelt [this message]
2003-01-22 10:28 reichelt
2003-03-18 21:16 jason
2003-03-19 18:25 jason

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=20030116095547.30684.qmail@sources.redhat.com \
    --to=reichelt@igpm.rwth-aachen.de \
    --cc=dunkel@Synopsys.COM \
    --cc=gcc-bugs@gcc.gnu.org \
    --cc=gcc-gnats@gcc.gnu.org \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=nobody@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).