Issue 80953
Summary Clang-Tidy: [misc-redundant-_expression_] false positive for fold _expression_ (...)
Labels clang-tidy
Assignees
Reporter HirthammerAllTerra
    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.

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to