From: Daniel Jacobowitz <drow@mvista.com>
To: David Carlton <carlton@math.stanford.edu>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [rfa] handle integer downsizing correctly in C++ overloading
Date: Tue, 04 Feb 2003 19:10:00 -0000 [thread overview]
Message-ID: <20030204183222.GB22089@nevyn.them.org> (raw)
In-Reply-To: <ro1fzr9gkie.fsf@jackfruit.Stanford.EDU>
On Fri, Jan 31, 2003 at 11:57:29AM -0800, David Carlton wrote:
> GDB currently won't let you do narrowing integer conversions when
> calling an overloaded C++ function: compile this,
>
> int overloadChar(char c)
> {
> return 29;
> }
>
> int main()
> {
> overloadChar(1);
> }
>
> break on main, and try to print overloadChar(1).
>
> The problem is that gdbtypes.h defines both INTEGER_COERCION_BADNESS
> and INTEGER_CONVERSION_BADNESS. The former is unacceptably bad; the
> latter isn't preferred, but isn't acceptable. And in all (or almost
> all) cases, the type comparison functions use INTEGER_COERCION_BADNESS
> when doing narrowing integer comparisons, when they should use
> INTEGER_CONVERSION_BADNESS.
>
> In fact, INTEGER_COERCION_BADNESS shouldn't exist: there's no such
> thing as an unacceptably bad integer conversion. So this patch
> changes all uses of INTEGER_COERCION_BADNESS to refer to
> INTEGER_CONVERSION_BADNESS, deletes INTEGER_COERCION_BADNESS, and also
> deletes FLOAT_COERCION_BADNESS (which is similarly unnecessary but
> which is already correctly unused). And there's a testsuite patch
> included to catch this as well.
>
> Tested on i686-pc-linux-gnu/GCC3.1/DWARF-2; OK to commit?
I (still) don't have a copy of the standard; I think I'll see about
getting one this week. However, your explanation makes sense, and
matches my reading of the conversion code that GCC uses for overload
resolution (gcc/cp/call.c:build_conv and standard_conversion). This
patch is OK.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
next prev parent reply other threads:[~2003-02-04 19:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-31 19:57 David Carlton
2003-01-31 20:04 ` David Carlton
2003-02-04 19:10 ` Daniel Jacobowitz [this message]
2003-02-04 21:23 ` David Carlton
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=20030204183222.GB22089@nevyn.them.org \
--to=drow@mvista.com \
--cc=carlton@math.stanford.edu \
--cc=gdb-patches@sources.redhat.com \
/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