[PATCH] D153276: [clang][Interp] Reject reinterpret_cast expressions
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 21 06:15:05 PDT 2023
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.
LGTM with the Dynamic bit pulled.
================
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;
----------------
tbaeder wrote:
> 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.
Ah, that's right, this isn't calling the diagnostic streaming operator. Nevermind. :-)
================
Comment at: clang/lib/AST/Interp/PrimType.h:48
+ Reinterpret,
+ Dynamic,
+};
----------------
tbaeder wrote:
> 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.
Let's yank it for the moment.
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