diff options
Diffstat (limited to 'gcc/cp/typeck.c')
| -rw-r--r-- | gcc/cp/typeck.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 21e7fe4a4ee..0e23e9a48c6 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -4995,6 +4995,7 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs) tree lhstype = TREE_TYPE (lhs); tree olhstype = lhstype; tree olhs = NULL_TREE; + bool plain_assign = (modifycode == NOP_EXPR); /* Avoid duplicate error messages from operands that had errors. */ if (lhs == error_mark_node || rhs == error_mark_node) @@ -5254,6 +5255,8 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs) lhstype, lhs, newrhs); TREE_SIDE_EFFECTS (result) = 1; + if (!plain_assign) + TREE_NO_WARNING (result) = 1; /* If we got the LHS in a different type for storing in, convert the result back to the nominal type of LHS @@ -5285,7 +5288,10 @@ build_x_modify_expr (tree lhs, enum tree_code modifycode, tree rhs) make_node (modifycode), /*overloaded_p=*/NULL); if (rval) - return rval; + { + TREE_NO_WARNING (rval) = 1; + return rval; + } } return build_modify_expr (lhs, modifycode, rhs); } |

