This is the mail archive of the gcc-patches@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]

[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.


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