[clang] [clang][analyzer] Detect use-after-move for 3-arg std::move (PR #196602)
Balázs Benics via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 2 04:28:00 PDT 2026
================
@@ -1015,3 +1015,22 @@ struct OtherMoveSafeClasses {
// aggressive-note at -2 {{Moved-from object 'Task' is moved}}
}
};
+
+void safeOperatorAfterMove() {
+ std::list<std::string> l1;
+ l1.push_back("l1");
+ std::list<std::string> l2;
----------------
steakhal wrote:
It is a bit a double-edged sword because all of these tests share the same reporting line. Consequently, it makes it more difficult to see which case breaks the expectation.
It's also technically incorrect because we pass an empty container - yet, we expect that it at least had one element initially. So I think an explicit template instantiation would be more correct - instead of spelling out calls and relying on implicit instantiations.
https://github.com/llvm/llvm-project/pull/196602
More information about the cfe-commits
mailing list