This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR C++/28989, post-increment of bool is wrongly considered a lvalue
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 13 Sep 2006 18:22:15 -0700
- Subject: [PATCH] Fix PR C++/28989, post-increment of bool is wrongly considered a lvalue
The problem here is that boolean_increment creates a COMPOUND_EXPR which
is considered a lvalue to the C++ front-end. We just need to wrap the
SAVE_EXPR around with a NON_LVALUE_EXPR and this tells the C++ front-end
that this is not a lvalue.
OK? Bootstrapped and tested on i686-linux-gnu with no regressions.
Thanks,
Andrew Pinski
ChangeLog:
* c-common.c (boolean_increment <case POSTINCREMENT_EXPR>):
Wrap the SAVE_EXPR with a NON_LVALUE_EXPR.
testsuite/ChangeLog:
* g++.dg/expr/lval4.C: new test.