From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24518 invoked by alias); 4 Feb 2003 19:10:20 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 24511 invoked from network); 4 Feb 2003 19:10:20 -0000 Received: from unknown (HELO crack.them.org) (65.125.64.184) by 172.16.49.205 with SMTP; 4 Feb 2003 19:10:20 -0000 Received: from nevyn.them.org ([66.93.61.169] ident=mail) by crack.them.org with asmtp (Exim 3.12 #1 (Debian)) id 18g9kr-0000CI-00; Tue, 04 Feb 2003 14:33:17 -0600 Received: from drow by nevyn.them.org with local (Exim 3.36 #1 (Debian)) id 18g7rq-0006P9-00; Tue, 04 Feb 2003 13:32:22 -0500 Date: Tue, 04 Feb 2003 19:10:00 -0000 From: Daniel Jacobowitz To: David Carlton Cc: gdb-patches@sources.redhat.com Subject: Re: [rfa] handle integer downsizing correctly in C++ overloading Message-ID: <20030204183222.GB22089@nevyn.them.org> Mail-Followup-To: David Carlton , gdb-patches@sources.redhat.com References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.1i X-SW-Source: 2003-02/txt/msg00129.txt.bz2 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