Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion clang-tools-extra/clang-tidy/misc/ConstCorrectnessCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ void ConstCorrectnessCheck::check(const MatchFinder::MatchResult &Result) {
CheckValue();
if (WarnPointersAsPointers) {
if (const auto *PT = dyn_cast<PointerType>(VT)) {
if (!PT->getPointeeType().isConstQualified())
if (!PT->getPointeeType().isConstQualified() &&
!PT->getPointeeType()->isFunctionType())
CheckPointee();
}
if (const auto *AT = dyn_cast<ArrayType>(VT)) {
Expand Down
4 changes: 4 additions & 0 deletions clang-tools-extra/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,10 @@ Changes in existing checks
- Improved :doc:`misc-header-include-cycle
<clang-tidy/checks/misc/header-include-cycle>` check performance.

- Improved :doc:`misc-const-correctness
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep alphabetical order (by check name) in this list.

<clang-tidy/checks/misc/const-correctness>` check by fixing false positives
of function pointer.

- Improved :doc:`modernize-avoid-c-arrays
<clang-tidy/checks/modernize/avoid-c-arrays>` to not diagnose array types
which are part of an implicit instantiation of a template.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,7 @@ void ignore_const_alias() {
p_local0 = &a[1];
}

void function_pointer_basic() {
void (*const fp)() = nullptr;
fp();
}