[PATCH] D110482: [clang] Implement if consteval (P1938)

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 4 11:25:21 PDT 2021


aaron.ballman added a reviewer: rsmith.
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

Aside from a nit, I think this is ready to go. Adding Richard in case he has the chance to give this a once-over before it lands.



================
Comment at: clang/lib/Parse/ParseStmt.cpp:1522-1526
+    auto IsCompoundStatement = [](const Stmt *Stmt) {
+      if (const AttributedStmt *Outer = dyn_cast_or_null<AttributedStmt>(Stmt))
+        Stmt = Outer->getSubStmt();
+      return isa_and_nonnull<class CompoundStmt>(Stmt);
+    };
----------------



================
Comment at: clang/test/CXX/stmt.stmt/stmt.select/stmt.if/p4.cpp:4
+void test_consteval() {
+  if consteval ({1;}); // expected-error {{expected { after consteval}}
+  if consteval (void) 0; // expected-error {{expected { after consteval}}
----------------
It looks like you dropped the test for GNU statement expressions; can you add that one back (it's helpful to ensure we don't accidentally regress behavior in the future given how closely these relate to compound statements already).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110482



More information about the cfe-commits mailing list