[PATCH] D74692: [clang-tidy][bugprone-use-after-move] Warn on std::move for consts
Zinovy Nis via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Mar 7 00:01:41 PST 2020
zinovy.nis added inline comments.
================
Comment at: clang-tools-extra/test/clang-tidy/checkers/bugprone-use-after-move.cpp:342
+ // CHECK-NOTES: [[@LINE-5]]:20: note: variable 'a' implicitly captured const here
};
}
----------------
aaron.ballman wrote:
> One more test case to try out (it might be a FIXME because I imagine this requires flow control to get right):
> ```
> A a;
> std::move(a);
>
> auto lambda = [=] {
> a.foo(); // Use of 'a' after it was moved
> }
> ```
`a` in lambda is `const`, but it's not moved inside lambda, so my warning is not expected to be shown.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74692/new/
https://reviews.llvm.org/D74692
More information about the cfe-commits
mailing list