[PATCH] D44883: [Sema] Extend -Wself-assign and -Wself-assign-field to warn on overloaded self-assignment (classes)
Eric Fiselier via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 2 15:30:23 PDT 2018
EricWF added a comment.
One thing I would like to see in this patch is ensuring the warning doesn't get generated when the expression appears in unevaluated contexts, such as `decltype` and `noexcept`. The warning is fundamentally about dataflow, but this doesn't apply to unevaluated expressions.
There are plenty of cases where a user might want to ask if assignment is well formed on `noexcept` using only one variable. For example:
template <class T> void foo(T& value) noexcept(noexcept(value = value)) { /* perform an assignment somewhere */ }
Repository:
rC Clang
https://reviews.llvm.org/D44883
More information about the cfe-commits
mailing list