[clang-tools-extra] [clang-tidy] Skip `decltype(auto)` variables in misc-const-correctness (PR #224465)

Yanzuo Liu via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 17 18:54:06 PDT 2026


================
@@ -142,6 +147,9 @@ void ConstCorrectnessCheck::registerMatchers(MatchFinder *Finder) {
   const auto FunctionPointerRef =
       hasType(hasCanonicalType(referenceType(pointee(functionType()))));
 
+  // 'const' cannot be combined with 'decltype(auto)'.
+  const auto DecltypeAutoType = hasTypeLoc(hasContainedDecltypeAutoType());
----------------
zwuis wrote:

`hasType(autoType(/* custom AST matcher */))`

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


More information about the cfe-commits mailing list