This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
generalized lvalues
- From: Matt Austern <austern at apple dot com>
- To: gcc mailing list <gcc at gcc dot gnu dot org>
- Date: Wed, 17 Nov 2004 19:47:17 -0800
- Subject: generalized lvalues
Could somebody remind me, please, of the reasons we removed generalized
lvalues? I know there were several reasons, but I'm not sure if I've
ever seen a complete list. Here are the reasons I can reconstruct from
memory:
1. It broke valid C++ programs. If we overload a function on
constness, like foo(int&) and foo(const int&), then invoking it as
foo((int) x) is required to call the const version. Generalized
lvalues made us choose the latter.
2. It was underspecified. There were cases, again especially in C++ in
the presence of operator overloading, where nobody was quite sure
either what it did or what it was supposed to do.
3. I have the vague sense that it caused back end bugs, but I can't
find them offhand.
Anything else? (Incidentally, I think all of these apply to
cast-as-lvalue. I haven't heard of any problems caused by
conditional-as-lvalue or comma-expression-as-lvalue.)
The reason I'm asking: I think some people are going to find the
removal a nasty surprise. Yes, it was deprecated in 3.3.x and 3.4.x,
but not everyone upgrades to the latest release of older branches. I
imagine some people won't have noticed the discussion about removal
until they upgrade to 4.0 and see that it's gone. At that point we'll
have three choices: convince them that removing it made the compiler
better, or reconsider and put it back, or refuse to put it back, don't
tell anyone why it's gone, and live with unhappy users who think we're
stupid and capricious. If we want to go with one of the first two
options, it'll help to have a collection of reasons.
--Matt