[clang] [Clang][C2y] Add support for if declarations (N3356 paper) (PR #198244)

Muhammad Bassiouni via cfe-commits cfe-commits at lists.llvm.org
Thu May 21 21:00:35 PDT 2026


================
@@ -0,0 +1,58 @@
+// RUN: %clang_cc1 -std=c2y -verify %s
+
+bool test_if() {
+  if (true) {}
+  if (bool x = true; x) {}
+  if (bool x = false) return x;
+  if ([[maybe_unused]] bool x = true) {}
+  if (bool x [[maybe_unused]] = true) {}
+  if ([[maybe_unused]] int x = 3; x > 0) {}
+  return false;
+}
----------------
bassiounix wrote:

I added support for both static assert decl and attribute-seq decl with some nice error logs and warnings :)

https://github.com/llvm/llvm-project/pull/198244


More information about the cfe-commits mailing list