[clang] [clang][Parse] Fix __extension__ not silencing diagnostics (PR #221623)

Yanzuo Liu via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 7 18:29:55 PDT 2026


================
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 %s -fsyntax-only -pedantic -verify -std=c17
+// RUN: %clang_cc1 %s -fsyntax-only -pedantic -verify -std=c2y
+// RUN: %clang_cc1 %s -fsyntax-only -pedantic -verify -x c++ -std=c++17
+
+// expected-no-diagnostics
+
+int f(int);
+
+void cond(int a) {
+  if (__extension__ ({ int r = f(a); r; })) {}
+  while (__extension__ ({ int r = f(a); r; })) { break; }
+  switch (__extension__ ({ int r = f(a); r; })) { default: break; }
+  do {} while (__extension__ ({ int r = f(a); r; }));
+  for (; __extension__ ({ int r = f(a); r; });) { break; }
+}
----------------
zwuis wrote:

@zhangweize9-cyber Please read <https://clang.llvm.org/docs/InternalsManual.html#testing>. Thanks.

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


More information about the cfe-commits mailing list