diff options
Diffstat (limited to 'gcc/cp/expr.c')
-rw-r--r-- | gcc/cp/expr.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/cp/expr.c b/gcc/cp/expr.c index 9160043..212a7f9 100644 --- a/gcc/cp/expr.c +++ b/gcc/cp/expr.c @@ -207,6 +207,28 @@ mark_use (tree expr, bool rvalue_p, bool read_p, recurse_op[0] = true; break; + case MODIFY_EXPR: + { + tree lhs = TREE_OPERAND (expr, 0); + /* [expr.ass] "A simple assignment whose left operand is of + a volatile-qualified type is deprecated unless the assignment + is either a discarded-value expression or appears in an + unevaluated context." */ + if (read_p + && !cp_unevaluated_operand + && (TREE_THIS_VOLATILE (lhs) + || CP_TYPE_VOLATILE_P (TREE_TYPE (lhs))) + && !TREE_THIS_VOLATILE (expr)) + { + warning_at (location_of (expr), OPT_Wvolatile, + "using value of simple assignment with %<volatile%>-" + "qualified left operand is deprecated"); + /* Make sure not to warn about this assignment again. */ + TREE_THIS_VOLATILE (expr) = true; + } + break; + } + default: break; } |