================
@@ -41,6 +41,10 @@ AST_MATCHER_P2(Expr, hasSideEffect, bool, CheckFunctionCalls,
   }
 
   if (const auto *OpCallExpr = dyn_cast<CXXOperatorCallExpr>(E)) {
+    if (const auto *MethodDecl =
+            dyn_cast_or_null<CXXMethodDecl>(OpCallExpr->getDirectCallee()))
+      return !MethodDecl->isConst();
----------------
PiotrZSL wrote:

What if called operator is ->, for example in assert we call -> operator on 
std::shared_ptr just to get member, and then we call const method, this could 
cause false-positive.

https://github.com/llvm/llvm-project/pull/71974
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to