[PATCH] D121211: Properly diagnose constant evaluation issues at TU scope

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 8 06:33:25 PST 2022


cor3ntin accepted this revision.
cor3ntin added a comment.
This revision is now accepted and ready to land.

There is already an evaluation context created in Sema but it's never popped back.
And because we rely heavily on there always being at least one evaluation context (`ExprEvalContexts.back()` is used all over the place for example), i think it make somewhat sense to have 2.

So this looks good to me. I wonder if we need a comment?



================
Comment at: clang/test/SemaCXX/cxx2a-consteval.cpp:699
+
+S s; // expected-error {{call to consteval function 'NamespaceScopeConsteval::S::S' is not a constant expression}} \
+        expected-note {{subobject of type 'int' is not initialized}}
----------------
I know there are more patches coming up and i don't remember what's broken or not, but if at all possible, can you add a test for a variable template instantiation too?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121211



More information about the cfe-commits mailing list