| Issue |
66204
|
| Summary |
false positive for clang-tidy rule 'misc-const-correctness'
|
| Labels |
clang-tidy,
new issue
|
| Assignees |
|
| Reporter |
a3emdot
|
I use clang-tidy 15.0.7 from Fedora 37
consider the following reproducer
```
#include <iostream>
class X {
public:
int a;
int b;
};
void func( X& x, int X::* m )
{
/*const*/ X& tmp = x;
tmp.*m = 77;
}
int main()
{
X x;
x.a = 0;
x.b = 0;
std::cout << x.a << " " << x.b << std::endl;
func(x, &X::a);
std::cout << x.a << " " << x.b << std::endl;
return 0;
}
```
The ```/* const */``` marked line gets tagged with 'misc-const-correctness'.
Though adding that 'const' clearly results in a compilation error with g++ (12.3.1) or clang++ (15.0.7)
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs