Commit 72fe2d2
[clang-tidy]misc-const-correctness fix fake positive of function pointer (#162079)
Fix clang-tidy misc-const-correctness of function pointer, because
function pointer can't be declared as `const*const`
```
void function_pointer_basic() {
void (*const fp)() = nullptr;
fp();
}
test.cpp:2:3: warning: pointee of variable 'fp' of type 'void (*const)()' can be declared 'const' [misc-const-correctness]
2 | void (*const fp)() = nullptr;
| ^
| const
```
---------
Co-authored-by: Congcong Cai <[email protected]>1 parent 066ee51 commit 72fe2d2
File tree
3 files changed
+9
-2
lines changed- clang-tools-extra
- clang-tidy/misc
- docs
- test/clang-tidy/checkers/misc
3 files changed
+9
-2
lines changedLines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
252 | | - | |
| 252 | + | |
| 253 | + | |
253 | 254 | | |
254 | 255 | | |
255 | 256 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
328 | 328 | | |
329 | 329 | | |
330 | 330 | | |
331 | | - | |
| 331 | + | |
| 332 | + | |
332 | 333 | | |
333 | 334 | | |
334 | 335 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
51 | 56 | | |
52 | 57 | | |
53 | 58 | | |
| |||
0 commit comments