File tree Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -249,7 +249,8 @@ void ConstCorrectnessCheck::check(const MatchFinder::MatchResult &Result) {
249
249
CheckValue ();
250
250
if (WarnPointersAsPointers) {
251
251
if (const auto *PT = dyn_cast<PointerType>(VT)) {
252
- if (!PT->getPointeeType ().isConstQualified ())
252
+ if (!PT->getPointeeType ().isConstQualified () &&
253
+ !PT->getPointeeType ()->isFunctionType ())
253
254
CheckPointee ();
254
255
}
255
256
if (const auto *AT = dyn_cast<ArrayType>(VT)) {
Original file line number Diff line number Diff line change @@ -321,6 +321,10 @@ Changes in existing checks
321
321
- Improved :doc: `misc-header-include-cycle
322
322
<clang-tidy/checks/misc/header-include-cycle>` check performance.
323
323
324
+ - Improved :doc: `misc-const-correctness
325
+ <clang-tidy/checks/misc/const-correctness>` check by fixing false positives
326
+ of function pointer.
327
+
324
328
- Improved :doc: `modernize-avoid-c-arrays
325
329
<clang-tidy/checks/modernize/avoid-c-arrays>` to not diagnose array types
326
330
which are part of an implicit instantiation of a template.
Original file line number Diff line number Diff line change @@ -48,3 +48,7 @@ void ignore_const_alias() {
48
48
p_local0 = &a[1 ];
49
49
}
50
50
51
+ void function_pointer_basic () {
52
+ void (*const fp)() = nullptr ;
53
+ fp ();
54
+ }
You can’t perform that action at this time.
0 commit comments