================ @@ -2208,15 +2208,27 @@ static bool interp__builtin_is_within_lifetime(InterpState &S, CodePtr OpPC, if (Ptr.isOnePastEnd()) return Error(1); - bool Result = true; + bool Result = Ptr.getLifetime() != Lifetime::Ended; if (!Ptr.isActive()) { Result = false; } else { if (!CheckLive(S, OpPC, Ptr, AK_Read)) return false; if (!CheckMutable(S, OpPC, Ptr)) return false; + if (!CheckDummy(S, OpPC, Ptr, AK_Read)) + return false; + } + + // Check if we're currently running an initializer. + for (InterpFrame *Frame = S.Current; Frame; Frame = Frame->Caller) { + if (const Function *F = Frame->getFunction(); + F && F->isConstructor() && Frame->getThis().block() == Ptr.block()) { + return Error(2); + } ---------------- tbaederr wrote:
Forgot to push that, thanks! https://github.com/llvm/llvm-project/pull/147480 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits