diff options
author | merrill <merrill@138bc75d-0d04-0410-961f-82ee72b054a4> | 1997-06-09 23:41:21 +0000 |
---|---|---|
committer | merrill <merrill@138bc75d-0d04-0410-961f-82ee72b054a4> | 1997-06-09 23:41:21 +0000 |
commit | 673abec302f4196afc67d8aad2c03ca4bb783d6a (patch) | |
tree | e6d725468f483644f0e4e3f2281f31a3e5cecda9 /gcc/fold-const.c | |
parent | aed993d82ec4418c09199efc3b9b7b6131fd5370 (diff) | |
download | gcc-673abec302f4196afc67d8aad2c03ca4bb783d6a.tar.gz |
x
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@14210 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 45311c91ed3..e8ef497176f 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -5498,14 +5498,21 @@ fold (expr) return pedantic_non_lvalue (convert (type, arg1)); case LE_EXPR: case LT_EXPR: - return pedantic_non_lvalue - (convert (type, (fold (build (MIN_EXPR, comp_type, - comp_op0, comp_op1))))); + /* In C++ a ?: expression can be an lvalue, so we can't + do this; we would lose the distinction between + LT and LE. */ + if (pedantic_lvalues) + return pedantic_non_lvalue + (convert (type, (fold (build (MIN_EXPR, comp_type, + comp_op0, comp_op1))))); + break; case GE_EXPR: case GT_EXPR: - return pedantic_non_lvalue - (convert (type, fold (build (MAX_EXPR, comp_type, - comp_op0, comp_op1)))); + if (pedantic_lvalues) + return pedantic_non_lvalue + (convert (type, fold (build (MAX_EXPR, comp_type, + comp_op0, comp_op1)))); + break; } } |