Issue 81641
Summary [clang-tidy] False negative readability-redundant-casting with typedef and using
Labels clang-tidy
Assignees
Reporter chrchr-github
    ~~~c++
typedef long LONG;
using ULONG = unsigned long;
void f(long x) {
    LONG y = static_cast<LONG>(x);
}
void g(unsigned long x) {
    ULONG y = static_cast<ULONG>(x);
}
void h(long x) {
    long y = static_cast<long>(x);
}
~~~
~~~
<source>:10:14: warning: redundant explicit casting to the same type 'long' as the sub-_expression_, remove this casting [readability-redundant-casting]
   10 |     long y = static_cast<long>(x);
      |              ^~~~~~~~~~~~~~~~~~ ~
<source>:9:13: note: source type originates from referencing this parameter]
    9 | void h(long x) {
      |        ~~~~ ^
~~~
There are no warnings for `f()` and `g()`.
https://godbolt.org/z/cxEs3WrdK
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to