<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/93282>93282</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
extend `misc-const-correctness` to private members
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
firewave
</td>
</tr>
</table>
<pre>
The check currently only applies to local variables but it would probably make sense to also extend this to private members.
```cpp
class C
{
public:
C(char * p)
: _p1(p)
, _p2(p)
{}
void f() {
if (_p1) {}
if (_p2) {}
}
private:
/*const*/ char * /*const*/ _p1;
const char * /*const*/ _p2;
};
```
https://godbolt.org/z/8Ezn63az5
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8UtuSmzAM_RrxoknGEYTLAw_Z3fIFfd8xRgR3DfbYJtvs13cgNHvrlGFASDo6x-LIEPR5Yq7h-ADHp0TOcbC-7rXnV3nhpLXdtf45MKqB1Quq2XueormincwVpXNGc8Bo0VglDV6k17I1HLCdI-qIr3Y2HTpvW9maK47yhTHwFHjBSBMs8u_IU4dx0Osc5_VFRsaRx5Z92IN4AnHanrm43cq5W0YZGQI-buXi4Ra4uTVaQbrBEBEfgUo1SI9AJ3RA1XsJ0hM-uwNQ-SVPj_js6HN-4SiePopaWi9Wd9gDlUAV3mXgdukegcqVovo04GsDfWu4R9taPp0JqAE6KTuFCHQCavB-wu-lhT79IGyt_R9Ad8Ai4x7__Qm3zyFGFxZZy4DmbLvWmri3_gzUvAE15Y-3KU_l2zHp6rSr0komXB-KQ37MSOQiGWqRccZ5UXIvq5LFsVdFqlKVUl9SVmSHRNckKBNHykR1yEjse9mVXVvmRV5VqswzyASPUpu9MZdx4U50CDPXVUolJUa2bMJqcCJl5HTeRd1dgWgxvK8X0K6dzwEyYXSI4X1M1NFwvTkUcjHqoHbrknbKes8qThwC5OIfzk1mb-ov29FxmNu9siNQs5Bsr53z9herCNSswgNQc9N-qelPAAAA___XhAwI">