[clang] [clang-tools-extra] [clang][clang-tidy] Fixes false positive with a non-const method on a pointer (PR #188844)

Zeyi Xu via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 1 22:13:23 PDT 2026


================
@@ -72,3 +72,14 @@ void instantiate() {
   // CHECK-FIXES: int *const p_local0[4] = {nullptr, nullptr, nullptr, nullptr};
   EmitProtocolMethodList(p_local0);
 }
+
+struct Mutating {
+  void mutating_method();
+};
+
+void pointer_member_call_not_pointer_mutation() {
+  Mutating *p = nullptr;
+  // CHECK-MESSAGES: warning: variable 'p' of type 'Mutating *' can be declared 'const'
----------------
zeyi2 wrote:

Nit: use `[[@LINE-n]]` format like above?

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


More information about the cfe-commits mailing list