[clang] [clang][analyzer] Fix InvalidatedIterator crash caused by overload operator member function with explicit this (PR #132581)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 24 05:36:34 PDT 2025
================
@@ -0,0 +1,21 @@
+// RUN: %clang_analyze_cc1 -std=c++23 %s -verify -analyzer-checker=alpha.cplusplus.InvalidatedIterator -analyzer-config aggressive-binary-operation-simplification=true
+
+// expected-no-diagnostics
+
+class ExplicitThis {
+ int f = 0;
+public:
+ ExplicitThis();
+ ExplicitThis(ExplicitThis& other);
+
+ ExplicitThis& operator=(this ExplicitThis& self, ExplicitThis const& other) { // no crash
+ self.f = other.f;
+ return self;
+ }
+
+ ~ExplicitThis();
+};
+
+void func(ExplicitThis& obj1) {
+ obj1 = obj1;
+}
----------------
flovent wrote:
Moved to `invalidated-iterator.cpp`(its original testfile)
https://github.com/llvm/llvm-project/pull/132581
More information about the cfe-commits
mailing list