From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21513 invoked by alias); 25 Feb 2003 12:36:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 21499 invoked by uid 71); 25 Feb 2003 12:36:00 -0000 Date: Tue, 25 Feb 2003 12:36:00 -0000 Message-ID: <20030225123600.21498.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Ansgar Esztermann Subject: Re: c++/9440: [3.4 regression] error message about non-lvalue Reply-To: Ansgar Esztermann X-SW-Source: 2003-02/txt/msg01319.txt.bz2 List-Id: The following reply was made to PR c++/9440; it has been noted by GNATS. From: Ansgar Esztermann To: gcc-gnats@gcc.gnu.org, , , , Cc: Subject: Re: c++/9440: [3.4 regression] error message about non-lvalue Date: Tue, 25 Feb 2003 13:33:00 +0100 (CET) As far as I can see, this is what happens: The compiler creates temporaries for args 2 and 3 of the conditional operator (i.e. A() and a in Andrew's example) by calling A(const A&). The parameter to the copy constructor is calculated by build_this() in cp/call.c. This function, however, only knows one way to calculate the this pointer: it uses ADDR_EXPR, which does not work for non- lvalues - hence the error message concerning "unary &". This problem did not occur prior to the patch cited by Craig, because the compiler would simply neglect to build temporaries for non-lvalues occurring as arguments to the conditional operator. I think the best way to fix PR 9440 (and probably 9537) is to fix build_this(), i.e. crawl along the tree (at least for non-lvalues) to find /this/ rather than blindly use ADDR_EXPR. I can try to implement this, but my knowledge about the internals of cc1plus is rather scarce, so if you a quick solution is needed, someone else might want to step forward. Ansgar -- Institut fuer theoretische Physik II | Geb. 25.32.02 Heinrich-Heine-Universitaet Duesseldorf | +49-211-8112059 (phone) Universitaetsstr. 1 | +49-211-8112262 (fax) D-40225 Duesseldorf, Germany |