<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/67896>67896</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] modernize-type-traits false positive
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
vient
</td>
</tr>
</table>
<pre>
https://godbolt.org/z/b537zPjo9
```cpp
namespace std {
template <class a>
struct disjunction : a {};
struct b {
static int value;
};
template <class>
using c = disjunction<b>;
auto c_v = c<b>::value;
} // namespace std
```
clang-tidy-17 and current trunk with `--checks=modernize-type-traits --extra-arg=-std=c++17` args produce
```
<source>:13:12: warning: use c++17 style variable templates [modernize-type-traits]
13 | auto c_v = c<b>::value;
| ^ ~~~~~~~
| _v
1 warning generated.
```
In other words, it advises to use `c_v` in definition of c_v. Renaming `std` namespace or `disjunction` struct or `value` field make the warning go away.
This is problematic if `--warnings-as-errors` is used, I did not manage to think of a way to bypass this bug other than copying the `std::disjunction` implementation to my namespace.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVMuO6jgQ_RqzKQUlNknIggWPi3R3o9HsW45TJO527MiuwNCL-faRE7qh6V7cCAWw63HOqYcMQbcWccPyHcsPCzlS5_zmrNHSonbNddMRDYGJLeNHxo-ta2pnaOl8y_jxnfFjnYvy_a9XV7H0wNItK9L5o4ZhPrGyxzBIhRCoAVbubobTm7AfjCQEJvbKyBBAMvFrvgvkR0XQ6PA6WkXaWWBiC3KKUR6Y-BLpZl3fMwAEkqQVaEtwlmbEu8s3929APmGMQdsWFDBxeMTCxL6ONl_DyJEcqJfzZK0-bbZMbJ8QfOCAWVj4ItOTlvNfZaRtE9LNNclKkLYBNXqPloD8aN_goqkDVqRJojpUb4GJQ-8a9Fa_Y0LXARPyUlOAJMF_yctE-paJQxLziYNifMf4LitZkYL0bYDBu2ZU-CMWJvbBjV7hTC8T8cVjeS7SW23b-HMMCJ9hIdDVIJyl17I2CB-CB2D57kecLD98FBIyAazcwx_LC9MTXVj-CwD-m5_ny8fn5TzfZh8UoEWLXhI2yx81-G3BUYceLs43gfE9aALZnHXAAOQm-nEQXs5RUm2hwZO2empkd4o0lvA3WtnHXKxIYx2K9KERnI_Hjz1XpHDr8_luJl2kcNJoGujlGwJ1eGfgQF7kdfnYc_90OoCeylsb7OcJOc2Nc_MLiQwJeu98mKCHyKWJDH9DoxuwjqCXVrYYeVKn7VtkJOEir_Gkvg5xlClmqsf2JhN10oJywzUiiyhvnKfyPbHU_WCwRxsH2NkYs7_elVkumo1oKlHJBW6yoiqyTJTlatFtKr4u1pimparXKERWrNOMi6pM8zVfZaJa6A1PuUgrkXK-4vlqWeUZF1nD12uxTleiZqsUe6nN0phzH_fcQocw4qYo11WxMLJGE6Ztyfl9IBnncXv6TXRK6rENbJUaHSjcw5AmM-3ZB7f8AD-P6EmagDC4oEmfcTF687yINXVjvVSuZ_wYc9y-ksG7V1TE-HHCHRg_TtD_DwAA__-CNM7z">