[clang-tools-extra] [clang-tidy] Teach `modernize-type-traits` about more type traits (PR #147074)
Victor Chernyakin via cfe-commits
cfe-commits at lists.llvm.org
Sat Jul 5 10:50:38 PDT 2025
================
@@ -130,6 +155,10 @@ static const llvm::StringSet<> TypeTraits = {
"result_of",
"invoke_result",
"type_identity",
+ "compare_three_way_result",
+ "common_comparison_category",
----------------
localspook wrote:
Hm, I've looked into it some more, and it turns out we do already have recursive traits: `common_type` and `common_reference` (also `conjunction` and `disjunction`, but those are "metatraits", they're somewhat different). So maybe recursive traits are alright? I've looked at some implementations, and I thought they were written like this:
```cpp
template <...>
struct trait {
using type = trait<...>::type; // Triggers the check.
};
```
but actually they seem to be written like this:
```cpp
template <...>
struct trait : trait<...> {}; // No warning.
```
https://github.com/llvm/llvm-project/pull/147074
More information about the cfe-commits
mailing list