[PATCH] D153276: [clang][Interp] Reject reinterpret_cast expressions
Timm Bäder via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 21 06:12:10 PDT 2023
tbaeder added inline comments.
================
Comment at: clang/lib/AST/Interp/Interp.h:1854
+ S.FFDiag(Loc, diag::note_constexpr_invalid_cast)
+ << static_cast<uint8_t>(Kind) << S.Current->getRange(OpPC);
+ return false;
----------------
aaron.ballman wrote:
> Should this be doing the cast? The overloaded operator accepts an `interp::CastKind` already?
The streaming operator there is for our `dump()` support, and the `note_constexpr_invalid_cast` diagnostic needs an integer to select the right string.
================
Comment at: clang/lib/AST/Interp/PrimType.h:48
+ Reinterpret,
+ Dynamic,
+};
----------------
aaron.ballman wrote:
> Should we bother adding this right now given it's not used or tested?
No strong opinion from my side, I can definitely remove it.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153276/new/
https://reviews.llvm.org/D153276
More information about the cfe-commits
mailing list