[PATCH] D145793: [clang][AST] Improve diagnostic for `nullptr` constexpr function pointer call
Shafik Yaghmour via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 10 14:59:09 PST 2023
shafik added inline comments.
================
Comment at: clang/lib/AST/ExprConstant.cpp:7673
+ Info.FFDiag(Callee, diag::note_constexpr_null_callee)
+ << const_cast<Expr *>(Callee);
+ return false;
----------------
hazohelet wrote:
> tbaeder wrote:
> > Is the `const_cast` really necessary?
> > Is the `const_cast` really necessary?
> Without `const_cast`, it did not compile.
> I searched the existing codebase to find this line https://github.com/llvm/llvm-project/blob/151d3b607e1e3256ed901e02b48b92e79a77021d/clang/lib/Sema/SemaConcept.cpp#L300 and I did the same here.
>
Yeah, we do seem to `const_cast` on `const Expr*` all over and in some places it is obviously harmless but others it is far from clear, at least on a cursory examination.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145793/new/
https://reviews.llvm.org/D145793
More information about the cfe-commits
mailing list