<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/80953>80953</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Clang-Tidy: [misc-redundant-expression] false positive for fold expression (...)
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-tidy
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          HirthammerAllTerra
      </td>
    </tr>
</table>

<pre>
    Inspired by [this StackOverflow answer](https://stackoverflow.com/a/71423954), I used C++17 fold expressions to check if all arguments of a variadic template are the same. Therefore, I defined the following template constant:

~~~ cpp
template <typename T_Type, typename... T_TypeList>
constexpr const bool is_all_same = (... && std::is_same_v<T_Type, T_TypeList>);
~~~

Clang-Tidy complains about it as follows:

~~~
error: both sides of operator are equivalent [misc-redundant-expression,-warnings-as-errors]
constexpr const bool is_all_same = (... && std::is_same_v<T_Type, T_TypeList>);
 ^
error: operator has equivalent nested operands [misc-redundant-expression,-warnings-as-errors]
constexpr const bool is_all_same = (... && std::is_same_v<T_Type, T_TypeList>);
~~~

This should be a false positive if I am not missing anything.

Tested it with clang-tidy 15 on Ubuntu 22.04 LTS.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUVE2P4zYM_TXKhYhhS3YSH3yYJBt0gQV62PQ8oC3aVleWXFFOmsv89sJOOtmZAj0W6MUfEsnHRz4SmU3niCpR7EVxXOEUex-qX0yIPQ4DhRdrzxQCrmqvb9VXx6MJpKG-gSj2sTcM3yM2P369UGitvwI6vlIQxVHIXR_jyEK9CHkS8sSznX_YJY0fhDyhkKdtlktVFrmQpZAH-AoTk4aDkHsh99kWWm810J9jIGbjHUP00PTU_ADTAloLGLppIBcZfAsIFwwGtWkg0jBajAQYCGJPwDhQAueeArU-0B1NU2sc6cWg9db6q3Hd07fxjiO6ONNIjyJ9PN_e3qAZx_vPu7FQh3gbyeFAcH4938YF4--jJEkep98MR6G-3L0XhJnfHQtq7y0YfkVrX-eMQagjCLmb3YXcCLkBjnrOR70YXkxeL0IdnoAfQWQp1P49659JHCy6bn02-gaNnykYx4C1nyKYCMiPevA_ud8_KAQfhHqB2sce2GhaWuBHChh9WOpOf0zmgpZcnAUzGG7WgfTkNLq4fnZVyMP6isEZ1_Eaeb2E5llG_3WNQBRfPtF7J9Qj_0zIEUfS92un-X9C8JMIzvMMc-8nq6EmQGjRMsHo2URzoXnIvgIO4HyEwTDP04HuFnvjuuRDoHs1TISriT00i7jiLK6sAO_gt3pycQIpkzSHb-fvD-eVrpQuVYkrqrJtupWl2uRq1VeZykuVljJL27xtU92mm2zTqjYrEDMp1cpUMpV5KtNtusvyVCUbreuyLEvcyl0um63IUxrQ2MTay5D40K0M80TVLi0LtbJYk-Vl8Un5zFZIOS_CUM1O63rqWOSpNRz5GSaaaKl6js8skn9tfnH8XNbWh8-b7dFfIcvVFGz1cXt2JvZT_VibcyKP13oM_ndqopCnhRwLeVr4_RUAAP__wrrmNw">