[all-commits] [llvm/llvm-project] 8f68dd: [clang-tidy] Skip `decltype(auto)` variables in mi...

David Meng via All-commits all-commits at lists.llvm.org
Fri Sep 18 07:38:22 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8f68ddfae4b36496d84ba9b7d54cdb0f7fe684d8
      https://github.com/llvm/llvm-project/commit/8f68ddfae4b36496d84ba9b7d54cdb0f7fe684d8
  Author: David Meng <davidmenggx at gmail.com>
  Date:   2026-09-18 (Fri, 18 Sep 2026)

  Changed paths:
    M clang-tools-extra/clang-tidy/misc/ConstCorrectnessCheck.cpp
    M clang-tools-extra/docs/ReleaseNotes.md
    A clang-tools-extra/test/clang-tidy/checkers/misc/const-correctness-decltype-auto.cpp

  Log Message:
  -----------
  [clang-tidy] Skip `decltype(auto)` variables in misc-const-correctness (#224465)

Since #157319 the check analyzes `auto` variables, which also pulled in
`decltype(auto)`. Its fix-it inserts `const`, but `decltype(auto)`
cannot be combined with other type specifiers, so the fix does not
compile:

```cpp
decltype(auto) x = get_ref();
decltype(auto) const x = get_ref();  // error
```

Exclude such variables from the analysis, as no `const` can be added.

Fixes #223940



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list