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) {
249249 CheckValue ();
250250 if (WarnPointersAsPointers) {
251251 if (const auto *PT = dyn_cast<PointerType>(VT)) {
252- if (!PT->getPointeeType ().isConstQualified ())
252+ if (!PT->getPointeeType ().isConstQualified () &&
253+ !PT->getPointeeType ()->isFunctionType ())
253254 CheckPointee ();
254255 }
255256 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
321321- Improved :doc: `misc-header-include-cycle
322322 <clang-tidy/checks/misc/header-include-cycle>` check performance.
323323
324+ - Improved :doc: `misc-const-correctness
325+ <clang-tidy/checks/misc/const-correctness>` check by fixing false positives
326+ of function pointer.
327+
324328- Improved :doc: `modernize-avoid-c-arrays
325329 <clang-tidy/checks/modernize/avoid-c-arrays>` to not diagnose array types
326330 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() {
4848 p_local0 = &a[1 ];
4949}
5050
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