public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/9440: [3.4 regression] error message about non-lvalue
@ 2003-02-25 12:36 Ansgar Esztermann
0 siblings, 0 replies; only message in thread
From: Ansgar Esztermann @ 2003-02-25 12:36 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c++/9440; it has been noted by GNATS.
From: Ansgar Esztermann <ansgar@thphy.uni-duesseldorf.de>
To: gcc-gnats@gcc.gnu.org, <gcc-bugs@gcc.gnu.org>, <nobody@gcc.gnu.org>,
<gcc-prs@gcc.gnu.org>, <andrew@andypo.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 |
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-02-25 12:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-25 12:36 c++/9440: [3.4 regression] error message about non-lvalue Ansgar Esztermann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).