aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/typeck.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/typeck.cc')
-rw-r--r--gcc/cp/typeck.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc
index 15548e5..6b38c8c 100644
--- a/gcc/cp/typeck.cc
+++ b/gcc/cp/typeck.cc
@@ -9136,10 +9136,14 @@ cp_build_modify_expr (location_t loc, tree lhs, enum tree_code modifycode,
/* An expression of the form E1 op= E2. [expr.ass] says:
"Such expressions are deprecated if E1 has volatile-qualified
- type." We warn here rather than in cp_genericize_r because
+ type and op is not one of the bitwise operators |, &, ^."
+ We warn here rather than in cp_genericize_r because
for compound assignments we are supposed to warn even if the
assignment is a discarded-value expression. */
- if (TREE_THIS_VOLATILE (lhs) || CP_TYPE_VOLATILE_P (lhstype))
+ if (modifycode != BIT_AND_EXPR
+ && modifycode != BIT_IOR_EXPR
+ && modifycode != BIT_XOR_EXPR
+ && (TREE_THIS_VOLATILE (lhs) || CP_TYPE_VOLATILE_P (lhstype)))
warning_at (loc, OPT_Wvolatile,
"compound assignment with %<volatile%>-qualified left "
"operand is deprecated");