<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/161913>161913</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] misc-const-correctness false positive with ->* operator
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy,
false-positive
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
BenBudr
</td>
</tr>
</table>
<pre>
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.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx0U02v4ygQ_DXtS8uR3cRfBx-cl8ltT2__AMYdhxUGC3De5N-vcDK7b6OdCCmoql10QbUMQc-WuYfqBNU5k1u8Od-f2J62yWejmx79H9rqRRrkn3JZDaO74sLLyB6lUhwC3rXE1Wkb2efR5S_yDXXjX6wiKrkFbWe8ShMYVxd01HcGMUCxr7p4rWII0W8q4idCc0JtI2oQJ4TmDOL0rL47PaEEahMLVAN1qTiV7HyCF6ktUAvUJaxJXyJ-YniKpC3QgGFFEOek8YtIsmHNQfwAGnaB-jO1KQadtKh7dfE861vb_9mLj-A2rzjJiKEFMQgQA35Jb7Wd0_Z5Rfut3qXXcjSMQE1YgZoExse6A3ufCVPS4sg4sTLS85Q45WyIiYPqtOig8h3IlfOeVbQcAlTn3S1ii9B8_Nb1_ksFiFD9eEMQ8XlSMZS_LODMlr2MPB3evA_rah6pIt4YwzbPHCJPeNU_cx3xy21m2tPAKFG5ZdVGRu0ssvfOJ7E_bzqgDvgMjDJyzqOeHkjlIZt6MXWikxn3ZVN1FTVd1Wa3vjmqitvxKqejurZdW0-iLLpyrORE47EWme6poKosCkHlsaqaQ9nSWFeqrJu2PSqa4FjwIrU5GHNfDs7PmQ5h476sy64UmZEjm7CPC5Ey0j6bAiKgDyDac53_k2uiNFW-T2L5uM0BjoXRIYZ_5aOOZp-_b2rVGf__Hd_mBr90vOErpOjW9BLOZ5s3_S3GNaTA0gXoMut428aDcgvQJR39-stX79JcAl12mwHo8nJ67-nvAAAA__8G3jxR">