<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/126987>126987</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] Check request: readability-avoid-enable-if
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
denzor200
</td>
</tr>
</table>
<pre>
Needs a check that will find redundant usage of `std::enable_if` and will suggest more simplified overloading without SFINAE at all.
For example, in 90% usages of `std::is_same` type trait in a cooperation with `std::enable_if` we don't really want it.
Look at the sample below...
```
template<typename T>
std::enable_if<std::is_same<T, int>::value>::type process(T value) {
// int's implementation..
}
template<typename T>
std::enable_if<!std::is_same<T, int>::value>::type process(const T& value) {
// generic implementation..
}
```
...which might be changed to:
```
void process(int value) {
// int's implementation..
}
template<typename T>
void process(const T& value) {
// generic implementation..
}
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyklFFvozgUhX-NebkKMnYI4YEHmjbSSqu-bN4rgy_grbFZ-5Js9tevIJ2ZTjtTaaYSEkLm-HzngK-K0fQOsWL5HcvvEzXT4EOl0f3ng-A8aby-VozXj4g6goJ2wPYZaFAEF2MtdMZpCKhnp5UjmKPqEXwHbMcjaSZrJmt0qrH4ZDq246Ccvinj3PcYCUYfEKIZJ2s6gxr8GYP1ShvXw8XQ4GeCv45_PNYPoAiUtSnj9dEHwH_VOFlk4gDGQcmZyG_-8S2AiU9RjbjY03VCoKAMLSIFrfcTBkXGu9Xt5-AXBO0dEwVBQGXtFS5LYkMLD-P1n94_L4Q0IMSVDBq0_pKm6ws7_nLxmnCcrCJk8rDgODUinJh8YLz-gbU8vMshD6dbalpU69JZ2Rm_Pq0pp-BbjJGJ_Qluy6IEVtwxXgMTRyaO6w6iiLC0jyM6Wou4ARf3t1y_SstE9mng1rtIcGJi944c4At8jw6DaT-Af9U543WappfBtAOMph8IGoR2UK5HDeQXiu8FZ2_0KyLj6AOUT_b4xuuD9L8TPdGV1KUsVYJVVshyy2Wey2SoulIJXpRtvs86ofi-7bjQfK92ouVZIbvEVIKLnItMCCnLTKYlL_d5o3al3LZ7zDq25TgqY1Nrz2PqQ5-YGGesMrEr90ViVYM2rrNFiNYq12_I6CsTYpk1oVpUm2buI9tyayLFb_uQIbtOpVey_B4O6_gJ-M-MkZisl6OoVWOsoetGLT1ubv_ixnTJHGw1EE1x-bprcb2hYW7S1o9MHBevl9tmCv5vbImJ4xogMnF8yXCuxP8BAAD__2m2mQw">