[PATCH] D147531: [clang] Reset track of immediate function context when entering new function

Mariya Podchishchaeva via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 4 07:53:45 PDT 2023


Fznamznon added inline comments.


================
Comment at: clang/lib/Sema/SemaDecl.cpp:15177
                           : ExprEvalContexts.back().Context);
+    ExprEvalContexts.back().InImmediateFunctionContext = FD->isConsteval();
 
----------------
cor3ntin wrote:
> I think it might be worth adding a comment there to explain why this is necessary.
> I think i convinced myself this make sense and is almost certainly the correct fix but it would, I think, benefit from some more explanation for future reference.
> 
> 
Sure, done. Hope it turned out helpful.


================
Comment at: clang/test/CodeGenCXX/cxx20-consteval-crash.cpp:138
+
+} // namespace GH61142
----------------
cor3ntin wrote:
> 
> Just to make sure, did you check that this fixes the other examples in the issue? I was afraid i reduced too much
Yes, it helps to fix them. I checked even the original big one.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147531/new/

https://reviews.llvm.org/D147531



More information about the cfe-commits mailing list