[clang] [clang] static operators should evaluate object argument (PR #68485)

Tianlan Zhou via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 11 03:41:19 PDT 2023


================
@@ -7806,7 +7806,8 @@ class ExprEvaluatorBase
       // Overloaded operator calls to member functions are represented as normal
       // calls with '*this' as the first argument.
       const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD);
-      if (MD && MD->isImplicitObjectMemberFunction()) {
+      if (MD &&
+          (MD->isImplicitObjectMemberFunction() || (OCE && MD->isStatic()))) {
----------------
SuperSodaSea wrote:

It doesn't look like anything has gone wrong so far, but just to be on the safe side, maybe we could change the code below to this?

```diff
- This = &ThisVal;
+ if (MD->isInstance())
+   This = &ThisVal;
```

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


More information about the cfe-commits mailing list