From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16080 invoked by alias); 22 Nov 2004 21:23:30 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 16051 invoked from network); 22 Nov 2004 21:23:26 -0000 Received: from unknown (HELO mail-out4.apple.com) (17.254.13.23) by sourceware.org with SMTP; 22 Nov 2004 21:23:26 -0000 Received: from mailgate2.apple.com (a17-128-100-204.apple.com [17.128.100.204]) by mail-out4.apple.com (8.12.11/8.12.11) with ESMTP id iAMLUEbY022131 for ; Mon, 22 Nov 2004 13:30:14 -0800 (PST) Received: from relay1.apple.com (relay1.apple.com) by mailgate2.apple.com (Content Technologies SMTPRS 4.3.14) with ESMTP id ; Mon, 22 Nov 2004 13:23:25 -0800 Received: from [17.201.24.249] (isolde.apple.com [17.201.24.249]) by relay1.apple.com (8.12.11/8.12.11) with ESMTP id iAMLNMVl003356; Mon, 22 Nov 2004 13:23:23 -0800 (PST) In-Reply-To: <7688EB08-3CC7-11D9-AEB4-000A95D692F4@physics.uc.edu> References: <4D2CF60C-3919-11D9-8BD2-000A95BCF344@apple.com> <20041117212847.A26376@synopsys.com> <6F5FC748-7BBD-44B9-8DDC-246949F16102@apple.com> <20041118102741.A8347@synopsys.com> <77E8D36A-C0C2-4B03-964C-BEE0FE7BBBC3@apple.com> <98C86CD4-39E2-11D9-B2D5-000A95BCF344@apple.com> <20041119170011.A30410@synopsys.com> <9E6AD708-3A93-11D9-9070-000D9330C50E@apple.com> <20041119174042.A1311@synopsys.com> <90DC5074-3A96-11D9-9070-000D9330C50E@apple.com> <9CD04F70-3CC6-11D9-B847-000D9330C50E@apple.com> <7688EB08-3CC7-11D9-AEB4-000A95D692F4@physics.uc.edu> Mime-Version: 1.0 (Apple Message framework v619) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit Cc: Steve Naroff , gcc mailing list , Michael Matz , Ziemowit Laski , Joe Buck , Mike Stump From: Matt Austern Subject: Re: generalized lvalues -- patch outline Date: Mon, 22 Nov 2004 21:39:00 -0000 To: Andrew Pinski X-SW-Source: 2004-11/txt/msg00760.txt.bz2 On Nov 22, 2004, at 12:45 PM, Andrew Pinski wrote: > > On Nov 22, 2004, at 3:39 PM, Ziemowit Laski wrote: > >> On 19 Nov 2004, at 17.50, Ziemowit Laski wrote: >> >>> To put it another way, I'm only concerned with cases where the >>> compiler currently complains >>> about assigning to a non-lvalue, and the non-lvalue in question is a >>> cast of an lvalue. >> >> Indeed, I now appear to have a mainline mod for C and C++ which >> allows assignment to lvalue casts for pointer types. What follows is >> a high-level synopsis of what I did; if there is interest, I can whip >> up a full-fledged patch, complete with docs. Please let me know. > > > Just use a builtin as proposed by Nathan and others for the problem you > are trying to solve. The syntax for casts as lvalue just looks bad. > The builtin can return a reference (yes even in the C front-end you > can have references [varargs is an example of which is used as > references in the front-end]). Unfortunately, there is another reason for allowing some tamed version of assignment to casts: compatibility with other compilers. Microsoft and CodeWarrior both allow this in one form or another. (Microsoft for C only, CodeWarrior for C++ as well. CodeWarrior only allows some limited forms of assignments to casts, and doesn't treat a cast as a true lvalue, so they still get overload resolution right.) If it's possible to make some limited subset of this work without hurting C++ correctness, then I think we ought to do it. We don't want to gratuitously break compatibility with other compilers. --Matt