This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c++/9440: [3.4 regression] error message about non-lvalue


The following reply was made to PR c++/9440; it has been noted by GNATS.

From: Ansgar Esztermann <ansgar at thphy dot uni-duesseldorf dot de>
To: gcc-gnats at gcc dot gnu dot org, <gcc-bugs at gcc dot gnu dot org>, <nobody at gcc dot gnu dot org>,
        <gcc-prs at gcc dot gnu dot org>, <andrew at andypo dot net>
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            | 
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]