| Issue |
108846
|
| Summary |
[clang-tidy] `readability-redundant-casting` false positive on inheritance
|
| Labels |
clang-tidy
|
| Assignees |
|
| Reporter |
felix642
|
The following code snippet will trigger `readability-redundant-casting` and suggests removing the `static_cast`. Doing so would lead to a compilation failure.
```
class A
{
int a;
};
class B : public A
{
};
int main()
{
A a;
B b = static_cast<B>(a); // [warning: redundant explicit casting to the same type 'B' as the sub-_expression_, remove this casting [readability-redundant-casting]]
}
```
Godbolt : https://godbolt.org/z/qY1v196qG
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs