From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6406 invoked by alias); 27 Feb 2008 19:48:46 -0000 Received: (qmail 6398 invoked by uid 22791); 27 Feb 2008 19:48:46 -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; Wed, 27 Feb 2008 19:48:22 +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 OAA10221; Wed, 27 Feb 2008 14:31:33 -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 OAA02889; Wed, 27 Feb 2008 14:48:19 -0500 Message-ID: <47C5BE84.7050803@qnx.com> Date: Wed, 27 Feb 2008 20:00:00 -0000 From: Aleksandar Ristovski User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) 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> In-Reply-To: <20080227193546.GA11796@caradoc.them.org> 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-02/txt/msg00446.txt.bz2 Daniel Jacobowitz wrote: > On Wed, Feb 27, 2008 at 01:03:26PM -0500, Aleksandar Ristovski wrote: >> Hello, >> >> As described in the bug report 2416, the problem is with casting to a >> reference. The attached patch should fix this. > > /* You can't cast to a reference type. See value_cast_pointers > instead. */ > gdb_assert (code1 != TYPE_CODE_REF); > > Is casting to a reference type useful, or should we have issued an > error instead? C++ does not permit this. 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(); } > > 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.