You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[clang-tidy][false-positive] misc-const-correctness warns non-const pointer parameter despite passing function into function pointer #236012
misc-const-correctness warns that pointee of a pointer parameter from a function should be const, yet the very same function is passed into a function pointer that has a non-const pointer parameter.
We don't always control the function pointer signature. And in cases we don't control the signature, following the suggestion will cause the code to FTBFS.
<source>:4:14: warning: pointee of variable 'p' of type 'T *const' can be declared 'const' [misc-const-correctness]
4 | void destroy(T* const p) { delete p; }
| ^
| const
1 warning generated.
misc-const-correctness warns that pointee of a pointer parameter from a function should be const, yet the very same function is passed into a function pointer that has a non-const pointer parameter.
We don't always control the function pointer signature. And in cases we don't control the signature, following the suggestion will cause the code to FTBFS.
<source>:4:14: warning: pointee of variable 'p' of type 'T *const' can be declared 'const' [misc-const-correctness]
4 | void destroy(T* const p) { delete p; }
| ^
| const
1 warning generated.
Activity
llvmorg-github-actions commentedon Oct 27, 2026
@llvm/issue-subscribers-clang-tidy
Author: Yat Ho (tearfur)
Details
https://godbolt.org/z/fG16E4Pevmisc-const-correctnesswarns that pointee of a pointer parameter from a function should be const, yet the very same function is passed into a function pointer that has a non-const pointer parameter.We don't always control the function pointer signature. And in cases we don't control the signature, following the suggestion will cause the code to FTBFS.
Current trunk: 21a3030
yashaggarwal85d commentedon Oct 27, 2026
Hi! I have raised a pull request for this issue, lemme know if any change is needed. Thanks!