Issue 161913
Summary [clang-tidy] misc-const-correctness false positive with ->* operator
Labels clang-tidy, false-positive
Assignees
Reporter BenBudr
    Minimal example of member access via pointer-to-member via pointer-to-object causing false positive:

```
struct S { int i; };

void a(int &) {}

int main()
{
  S s;
  S * sp = &s;
 a(sp->*(&S::i));
}
```
```
<source>:8:3: warning: pointee of variable 'sp' of type 'S *' can be declared 'const' [misc-const-correctness]
    8 | S * sp = &s;
      |   ^
      |      const
1 warning generated.
```
Applying the suggested fix-it would cause a compilation error.
This is using clag-tidy 21.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to