This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/7828: g++ 3.3: bad non-lvalue error (non_cast_lvalue_or_else)
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: nobody at gcc dot gnu dot org
- Cc: gcc-prs at gcc dot gnu dot org,
- Date: 4 Sep 2002 19:26:01 -0000
- Subject: Re: c++/7828: g++ 3.3: bad non-lvalue error (non_cast_lvalue_or_else)
- Reply-to: Andrew Pinski <pinskia at physics dot uc dot edu>
The following reply was made to PR c++/7828; it has been noted by GNATS.
From: Andrew Pinski <pinskia@physics.uc.edu>
To: snyder@fnal.gov
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/7828: g++ 3.3: bad non-lvalue error (non_cast_lvalue_or_else)
Date: Wed, 4 Sep 2002 15:21:32 -0400
One question which libstdc++, because the version 3 is fine and it
compiles just fine with this patch?
Another point, it is invalid code, the problem is that the casting does
makes a variable not a lvalue.
gcc was accepting the invalid code because no one wanted to fix it
until Matt Austern did.
The error message is because when you pass an argument into a function
and that argument is a reference,
gcc tries to use the unary `&', which means take the memory location
that points to that lvalue.
Thanks,
Andrew Pinski
PS Also it is not illegal code but invalid code.