[clang] [analyzer] Fix crash on dereference invalid return value of getAdjustedParameterIndex() (PR #83585)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 2 09:31:00 PST 2024


================
@@ -0,0 +1,15 @@
+// RUN: %clang_analyze_cc1 -analyzer-checker=core.DivideZero -std=c++23 -verify %s
+// expected-no-diagnostics
+
+struct S
+{
+    constexpr auto operator==(this auto, S)
+    {
+        return true;
+    }
+};
+
+int main()
+{
+    return S {} == S {};
+}
----------------
steakhal wrote:

```suggestion
struct S {
  bool operator==(this auto, S) {
    return true;
  }
};

int use_deducing_this() {
  return S{} == S{};
}
```

https://github.com/llvm/llvm-project/pull/83585


More information about the cfe-commits mailing list