[flang-commits] [flang] [clang-analysis]Fix false positive in mutation check when using pointer to member function (PR #66846)
Congcong Cai via flang-commits
flang-commits at lists.llvm.org
Mon Sep 25 06:40:59 PDT 2023
================
@@ -274,8 +288,8 @@ const Stmt *ExprMutationAnalyzer::findDirectMutation(const Expr *Exp) {
const auto NonConstMethod = cxxMethodDecl(unless(isConst()));
const auto AsNonConstThis = expr(anyOf(
- cxxMemberCallExpr(callee(NonConstMethod),
- on(canResolveToExpr(equalsNode(Exp)))),
+ cxxMemberCallExpr(on(canResolveToExpr(equalsNode(Exp))),
+ unless(isConstCallee())),
----------------
HerrCai0907 wrote:
see this test case
```c++
buildASTFromCode("struct X {};"
"using T = int (X::*)() const;"
"void f(X &x, T m) { X &ref = x; (ref.*m)(); }");
```
https://github.com/llvm/llvm-project/pull/66846
More information about the flang-commits
mailing list