r374135 - [c++20] P1152R4: warn on any simple-assignment to a volatile lvalue
Stephan Bergmann via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 17 05:17:07 PDT 2019
On 09/10/2019 04:04, Richard Smith via cfe-commits wrote:
> Author: rsmith
> Date: Tue Oct 8 19:04:54 2019
> New Revision: 374135
>
> URL: http://llvm.org/viewvc/llvm-project?rev=374135&view=rev
> Log:
> [c++20] P1152R4: warn on any simple-assignment to a volatile lvalue
> whose value is not ignored.
>
> We don't warn on all the cases that are deprecated: specifically, we
> choose to not warn for now if there are parentheses around the
> assignment but its value is not actually used. This seems like a more
> defensible rule, particularly for cases like sizeof(v = a), where the
> parens are part of the operand rather than the sizeof syntax.
>
> Modified:
> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> cfe/trunk/include/clang/Sema/Sema.h
> cfe/trunk/lib/Sema/SemaExpr.cpp
> cfe/trunk/lib/Sema/SemaExprCXX.cpp
> cfe/trunk/test/SemaCXX/deprecated.cpp
> cfe/trunk/www/cxx_status.html
Oh, I should probably have commented here on the mailing list rather
than at
<https://github.com/llvm/llvm-project/commit/4a6861a7e5b59be24a09b8b9782255d028e7aade#commitcomment-35540755>:
I assume the scenario at
<https://gitlab.gnome.org/GNOME/glib/merge_requests/1170> "Avoid C++20
deprecated assignment to volatile",
(void) (0 ? *(location) = (result) : 0);
where *(location) is of (non-class) volatile type, is a true positive
that we indeed want to warn about?
More information about the cfe-commits
mailing list