From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15138 invoked by alias); 1 Apr 2008 15:54:10 -0000 Received: (qmail 15125 invoked by uid 22791); 1 Apr 2008 15:54:09 -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; Tue, 01 Apr 2008 15:53:49 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 28A72983BE; Tue, 1 Apr 2008 15:53:48 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id 0BFFF98119; Tue, 1 Apr 2008 15:53:48 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1Jginz-0005fQ-3w; Tue, 01 Apr 2008 11:53:47 -0400 Date: Tue, 01 Apr 2008 17:06:00 -0000 From: Daniel Jacobowitz To: Aleksandar Ristovski Cc: gdb-patches@sourceware.org Subject: Re: [patch] fix for c++/2416 Message-ID: <20080401155347.GA20960@caradoc.them.org> Mail-Followup-To: Aleksandar Ristovski , gdb-patches@sourceware.org References: <47F255CC.4000704@qnx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <47F255CC.4000704@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-04/txt/msg00022.txt.bz2 On Tue, Apr 01, 2008 at 11:33:32AM -0400, Aleksandar Ristovski wrote: > I believe we should. > > Here is a dummy c++ program where this is done explicitly: > > #include > using namespace std; > int main () > { > int a = 42; > int &refa = (int &)a; // cast not needed, yet compiler doesn't complain. > cout << refa << endl; > return 0; > } I had to ask two C++ experts what this meant and let them argue about it for a little while... it's even legal if a is a double. This is *reinterpret_cast(&a), an lvalue of type int. That's not what GDB will do with it, but it's close enough for now. If you'll delete the extra blank line, the patch and testcases are OK. Thanks for your patience. -- Daniel Jacobowitz CodeSourcery