From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2373 invoked by alias); 4 Mar 2008 19:39:52 -0000 Received: (qmail 2364 invoked by uid 22791); 4 Mar 2008 19:39:52 -0000 X-Spam-Check-By: sourceware.org Received: from qnxmail.qnx.com (HELO qnxmail.qnx.com) (209.226.137.76) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 04 Mar 2008 19:39:27 +0000 Received: from smtp.ott.qnx.com (smtp.ott.qnx.com [10.42.96.5]) by hub.ott.qnx.com (8.9.3/8.9.3) with ESMTP id OAA27473; Tue, 4 Mar 2008 14:21:49 -0500 Received: from [10.42.100.129] (dhcp-100-129 [10.42.100.129]) by smtp.ott.qnx.com (8.8.8/8.6.12) with ESMTP id OAA08258; Tue, 4 Mar 2008 14:39:24 -0500 Message-ID: <47CDA56C.6050804@qnx.com> Date: Tue, 04 Mar 2008 19:39:00 -0000 From: Aleksandar Ristovski User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 To: Daniel Jacobowitz CC: gdb-patches@sourceware.org Subject: Re: [patch] fix for c++/2416 References: <47C5A5EE.6070107@qnx.com> <20080227193546.GA11796@caradoc.them.org> <47C5BE84.7050803@qnx.com> <20080227200019.GB12434@caradoc.them.org> <47C5D138.6020909@qnx.com> <20080227220659.GE14556@caradoc.them.org> <47C70319.4050804@qnx.com> <20080228191516.GA8975@caradoc.them.org> <47C78DD3.4080109@qnx.com> In-Reply-To: <47C78DD3.4080109@qnx.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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-03/txt/msg00029.txt.bz2 Any thoughts on this? Your feedback would be greatly appreciated. Thanks, Aleksandar Ristovski QNX Software Systems Aleksandar Ristovski wrote: > Daniel Jacobowitz wrote: >> On Thu, Feb 28, 2008 at 01:53:13PM -0500, Aleksandar Ristovski wrote: >>> See revisited diff (attached). Also, please find attached the >>> testcase diff, I added check for reference casting. Do I need to >>> provide change log for tests too? >> >> The testsuite changes look fine but do need a changelog; that >> goes in testsuite/ChangeLog. > > 2008-02-28 Aleksandar Ristovski > > * gdb.cp/casts.cc: Add class reference variables. > * gdb.cp/casts.exp: New test cases for up/down casting references. > > >> >> There's nothing wrong with casting a reference to a non-reference; >> that coerces the reference. Also you have to beware typedefs. >> >> enum type_code code1, code2; >> code1 = TYPE_CODE (check_typedef (value_type (arg1))); >> code2 = TYPE_CODE (check_typedef (value_type (arg2))); >> >> if (code1 == TYPE_CODE_REF && code2 == TYPE_CODE_REF) >> arg1 = value_cast_pointers (type, arg1); >> else if (code1 == TYPE_CODE_REF) >> error (_("Attempt to cast to reference type from non-reference >> type.")); >> else >> arg1 = value_cast (type, arg1); > > Allright, then how about this, yet newer and yet more revisited diff? I > removed changes to eval.c and let it simply call value_cast as it used > to. Now value_cast knows how to handle references. > > > 2008-02-28 Aleksandar Ristovski > > * valops.c (value_cast_structs): New function. Cast related > STRUCT types up/down and return cast value. The body of this > function comes mostly from value_cast_pointers. > (value_cast_pointers): Code for actual cast STRUCT-STRUCT moved > to value_cast_structs. Now value_cast_pointers needs only create > appropriate reference after using value_cast_structs for actual > casting. > (value_cast): Handle references. > >