[clang] [analyzer] Support C++23 static operator calls (PR #84972)

via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 12 23:54:11 PDT 2024


================
@@ -0,0 +1,16 @@
+// RUN: %clang_analyze_cc1 -std=c++2b -verify %s \
+// RUN:   -analyzer-checker=core,debug.ExprInspection
+
+template <typename T> void clang_analyzer_dump(T);
----------------
tomasz-kaminski-sonarsource wrote:

To validate the argument indexing is correct (the function I have suggested). Could you add example when we construct prvalue of class type as argument:
```c++
struct Clazz {
   int x;
   int y;
   Clazz(int v) : x(v + 10), y(v + 20) {} 
};

struct StaticOp {
    static void operator[](Clazz v) {
       clang_analyzer_dump(v.x);
        clang_analyzer_dump(v.y);
    }
};

StaticOp s;
s[Calzz{10}];
```

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


More information about the cfe-commits mailing list