[clang] [clang][Interp] Bail out from type-punning casts (PR #163809)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 16 23:15:40 PDT 2025


================
@@ -212,6 +212,10 @@ template <class Emitter>
 bool Compiler<Emitter>::VisitCastExpr(const CastExpr *CE) {
   const Expr *SubExpr = CE->getSubExpr();
 
+  if (isPunningDereference(SubExpr))
+    return this->emitInvalidCast(CastKind::Reinterpret, /*Fatal=*/true,
----------------
tbaederr wrote:

I think it would be better to call this when we already switch'ed for the cast kind later.

https://github.com/llvm/llvm-project/pull/163809


More information about the cfe-commits mailing list