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

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 4 07:07:30 PDT 2023


cor3ntin added a comment.

Thanks, for working on this
Congrats on finding the underlying issue, it must not have been easy!



================
Comment at: clang/lib/Sema/SemaDecl.cpp:15177
                           : ExprEvalContexts.back().Context);
+    ExprEvalContexts.back().InImmediateFunctionContext = FD->isConsteval();
 
----------------
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.




================
Comment at: clang/test/CodeGenCXX/cxx20-consteval-crash.cpp:138
+
+} // namespace GH61142
----------------

Just to make sure, did you check that this fixes the other examples in the issue? I was afraid i reduced too much


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