[clang] [clang-tools-extra] [clang-tidy] Fix false positives about references in `misc-const-correctness` (PR #160971)

Victor Chernyakin via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 27 17:06:20 PDT 2025


================
@@ -309,6 +309,10 @@ Changes in existing checks
 
   - ``for`` loops are supported.
 
+- Improved :doc:`misc-const-correctness
+  <clang-tidy/checks/misc/const-correctness>` check to avoid false
+  positives when pointers is tranferred to non-const references.
----------------
localspook wrote:

```suggestion
  positives when pointers to non-const are bound to references.
```
Since the false positive happens [whether the reference is const or not](https://godbolt.org/z/5zGvrW39n).

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


More information about the cfe-commits mailing list