[clang-tools-extra] [clang-tidy] make `misc-const-correctness` work with `auto` variables and lambdas (PR #157319)

Carlos Galvez via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 8 01:49:59 PDT 2025


================
@@ -10,6 +10,12 @@ template <typename T>
 void type_dependent_variables() {
   T value = 42;
   auto &ref = value;
+  // CHECK-MESSAGES:[[@LINE-1]]:3: warning: variable 'ref' of type 'int &' can be declared 'const'
+  // CHECK-FIXES: auto  const&ref = value;
----------------
carlosgalvezp wrote:

Ok, if this was already an issue then nevermind :) 

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


More information about the cfe-commits mailing list