diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -605,6 +605,8 @@ conforming GNU extensions. Projects incompatible with C++17 can add ``-std=gnu++14`` to their build settings to restore the previous behaviour. - Implemented DR2358 allowing init captures in lambdas in default arguments. +- implemented `DR2654 `_ which undeprecates + all compound assignements operations on volatile qualified variables. C++20 Feature Support ^^^^^^^^^^^^^^^^^^^^^ diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -7625,9 +7625,6 @@ def warn_deprecated_simple_assign_volatile : Warning< "use of result of assignment to object of volatile-qualified type %0 " "is deprecated">, InGroup; -def warn_deprecated_compound_assign_volatile : Warning< - "compound assignment to object of volatile-qualified type %0 is deprecated">, - InGroup; def warn_deprecated_volatile_return : Warning< "volatile-qualified return type %0 is deprecated">, InGroup; diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -13982,19 +13982,6 @@ // type is deprecated unless the assignment is either a discarded-value // expression or an unevaluated operand ExprEvalContexts.back().VolatileAssignmentLHSs.push_back(LHSExpr); - } else { - // C++20 [expr.ass]p6: - // [Compound-assignment] expressions are deprecated if E1 has - // volatile-qualified type and op is not one of the bitwise - // operators |, &, ˆ. - switch (Opc) { - case BO_OrAssign: - case BO_AndAssign: - case BO_XorAssign: - break; - default: - Diag(Loc, diag::warn_deprecated_compound_assign_volatile) << LHSType; - } } } diff --git a/clang/test/CXX/drs/dr26xx.cpp b/clang/test/CXX/drs/dr26xx.cpp --- a/clang/test/CXX/drs/dr26xx.cpp +++ b/clang/test/CXX/drs/dr26xx.cpp @@ -50,3 +50,13 @@ }; int i0 = f(0); //expected-error {{no matching function for call to 'f'}} } + +namespace dr2654 { // dr2654: 16 +void f() { + int neck, tail; + volatile int brachiosaur; + brachiosaur += neck; // OK + brachiosaur -= neck; // OK + brachiosaur |= neck; // OK +} +} diff --git a/clang/test/SemaCXX/deprecated.cpp b/clang/test/SemaCXX/deprecated.cpp --- a/clang/test/SemaCXX/deprecated.cpp +++ b/clang/test/SemaCXX/deprecated.cpp @@ -186,10 +186,10 @@ --n; // cxx20-warning {{decrement of object of volatile-qualified type 'volatile int' is deprecated}} n++; // cxx20-warning {{increment of object of volatile-qualified type 'volatile int' is deprecated}} n--; // cxx20-warning {{decrement of object of volatile-qualified type 'volatile int' is deprecated}} - n += 5; // cxx20-warning {{compound assignment to object of volatile-qualified type 'volatile int' is deprecated}} - n *= 3; // cxx20-warning {{compound assignment to object of volatile-qualified type 'volatile int' is deprecated}} - n /= 2; // cxx20-warning {{compound assignment to object of volatile-qualified type 'volatile int' is deprecated}} - n %= 42; // cxx20-warning {{compound assignment to object of volatile-qualified type 'volatile int' is deprecated}} + n += 5; // undeprecated as a DR in C++23 + n *= 3; // undeprecated as a DR in C++23 + n /= 2; // undeprecated as a DR in C++23 + n %= 42; // undeprecated as a DR in C++23 n &= 2; // undeprecated as a DR in C++23 n |= 2; // undeprecated as a DR in C++23 n ^= 2; // undeprecated as a DR in C++23 diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html --- a/clang/www/cxx_dr_status.html +++ b/clang/www/cxx_dr_status.html @@ -15732,7 +15732,7 @@ 2654 DR Un-deprecation of compound volatile assignments - Unknown + Clang 16