]> gcc.gnu.org Git - gcc.git/blobdiff - gcc/cp/typeck.cc
c++: Implement P2327R1 - De-deprecating volatile compound operations
[gcc.git] / gcc / cp / typeck.cc
index ceb80d9744f5f191f94e6e8a2beed4f3b807ad63..341869fc550f4ec7e7ab33c158becfd7e169403b 100644 (file)
@@ -9126,10 +9126,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");
This page took 0.03577 seconds and 5 git commands to generate.