From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10101 invoked by alias); 27 Feb 2008 20:00:42 -0000 Received: (qmail 10089 invoked by uid 22791); 27 Feb 2008 20:00:41 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 27 Feb 2008 20:00:22 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id AB00598140; Wed, 27 Feb 2008 20:00:20 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id 934259811F; Wed, 27 Feb 2008 20:00:20 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1JUSRv-0003ay-VO; Wed, 27 Feb 2008 15:00:20 -0500 Date: Wed, 27 Feb 2008 20:09:00 -0000 From: Daniel Jacobowitz To: Aleksandar Ristovski Cc: gdb-patches@sourceware.org Subject: Re: [patch] fix for c++/2416 Message-ID: <20080227200019.GB12434@caradoc.them.org> Mail-Followup-To: Aleksandar Ristovski , gdb-patches@sourceware.org References: <47C5A5EE.6070107@qnx.com> <20080227193546.GA11796@caradoc.them.org> <47C5BE84.7050803@qnx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <47C5BE84.7050803@qnx.com> User-Agent: Mutt/1.5.17 (2007-12-11) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-02/txt/msg00447.txt.bz2 On Wed, Feb 27, 2008 at 02:48:20PM -0500, Aleksandar Ristovski wrote: > Not sure what you mean by "C++ does not permit this"... > > This is valid: > > void testCast1 (IP::base & arg) { > IP::derived &ader = (IP::derived &)arg; > cout << "Test the casting\n"; > ader.foo(); > } Humph. You're right, of course. When I added that assertion I must not have thought about this case. I think you've put the fix in the right place; the reference behavior is a bit startling, so we would like to know if it comes up anywhere else in GDB besides from an expression. For expressions, casting one reference to another is OK; casting a reference to a non-reference is also fine. Only non-reference to reference is trouble. >> The new error is incorrect, which does suggest some missing tests. >> You can cast from a reference type; value_cast follows references, >> so an int is just like an int &. >> >> Like Michael, I don't understand the value.c changes. Could you >> explain them? >> > I replied to that. What about the changes to coerce_array? -- Daniel Jacobowitz CodeSourcery