[clang-tools-extra] [clang-tidy] add misc-constexpr check (PR #162741)

Julian Schmidt via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 9 14:43:58 PDT 2025


5chmidti wrote:

One issue that I have found when I ran this on VTK:
When specializing a function template, the check will add `constexpr` to the non-specialized template for each specialization. I have left this in for now, but maybe the check should instead not add `constexpr` to the non-specialized re-decl for every specialization. WDYT?

```diff
template <typename T>
- int foo();
+ constexpr constexpr int foo(); 

template <>
- int foo<int>() { return 10; }
+ constexpr int foo<int>() { return 10; }

template <>
- int foo<unsigned int>() { return 0; }
+ constexpr int foo<unsigned int>() { return 0; }

```

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


More information about the cfe-commits mailing list