rsmith added inline comments.
================ Comment at: clang/lib/Parse/ParseStmt.cpp:1445-1450 Sema::ExpressionEvaluationContext Context = Sema::ExpressionEvaluationContext::DiscardedStatement; - if (NotLocation.isInvalid() && IsConsteval) + if (NotLocation.isInvalid() && IsConsteval) { Context = Sema::ExpressionEvaluationContext::ImmediateFunctionContext; + ShouldEnter = true; + } ---------------- It looks to me like this is still incorrectly updating the context in some cases. We shouldn't enter an immediate function context if we're already in a discarded statement context. For example, Clang currently rejects this valid code: ``` auto f() { if constexpr (false) { if consteval { return 0; } } return 0.0; } ``` ... and it looks like it still will after this change. I think we should not enter a new context here if the existing context is a discarded statement context. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D112089/new/ https://reviews.llvm.org/D112089 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits