re PR c++/7503 ((x < Y ? X : Y) used for assignment causes wrong code)
authorRoger Sayle <roger@eyesopen.com>
Tue, 21 Sep 2004 16:20:12 +0000 (16:20 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Tue, 21 Sep 2004 16:20:12 +0000 (16:20 +0000)
commitd211a298ce7c5ff8b34323e0575480fc9f80ada9
treebdfafe1c2a29f4aa6bfe3cb981e141f67ff30e50
parentf0c721ad7cc43cb007beb8a55cb088f17a2a065b
re PR c++/7503 ((x < Y ? X : Y) used for assignment causes wrong code)

PR c++/7503
* tree.c (lvalue_p_1):  Disallow MIN_EXPR and MAX_EXPR as lvalues
if either operand has side-effects.
* typeck.c (rationalize_conditional_expr): Assert that neither
operand of MIN_EXPR or MAX_EXPR has side-effects.
(build_modify_expr):  Add support for MIN_EXPR and MAX_EXPR.
Check that the "lhs" is a valid lvalue, i.e. that neither operand
of a MIN_EXPR or MAX_EXPR has a side-effect.

* g++.dg/opt/pr7503-1.C: New testcase for COND_EXPR lvalues.
* g++.dg/opt/pr7503-2.C: New testcase for <? and >? lvalues.
* g++.dg/opt/pr7503-3.C: New testcase for invalid <? lvalue errors.
* g++.dg/opt/pr7503-4.C: New testcase for <?= and >?= assignments.
* g++.dg/opt/pr7503-5.C: New testcase for side-effects with <?=.

From-SVN: r87810
gcc/cp/ChangeLog
gcc/cp/tree.c
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/pr7503-1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/opt/pr7503-2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/opt/pr7503-3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/opt/pr7503-4.C [new file with mode: 0644]
gcc/testsuite/g++.dg/opt/pr7503-5.C [new file with mode: 0644]