5chmidti wrote:

> > misc-use-constexpr? :)
> 
> modernize-use-constexpr?

Hm. It is indeed also a modernization... +- on which to pick. Let's see what 
others think.
On one hand, the modernize checks have
- modernize-use-auto
- modernize-use-nodiscard
- modernize-use-noexcept
- modernize-use-override
- modernize-use-using

while the misc category has `misc-const-correctness`, which is also close to 
this check. Though, `constexpr` also provides additional benefits and not just 
modernization. It can provide additional safety checks if UB would be 
encountered at compile-time, e.g., 
```c++
constexpr int div(int a, int b) { return a / b; }
int main() {
  constexpr auto res = div(10,0);
  return 0;
}
```
, or potential performance improvements.

https://github.com/llvm/llvm-project/pull/146553
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to