[clang] a244194 - Add additional test coverage for C2x N2508

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 19 04:52:18 PDT 2022


Author: Aaron Ballman
Date: 2022-09-19T07:52:07-04:00
New Revision: a244194f73788de6dfd6d753ff09be3625613f9f

URL: https://github.com/llvm/llvm-project/commit/a244194f73788de6dfd6d753ff09be3625613f9f
DIFF: https://github.com/llvm/llvm-project/commit/a244194f73788de6dfd6d753ff09be3625613f9f.diff

LOG: Add additional test coverage for C2x N2508

This spotted a mistake with the original patch, so it puts the status
back to "partial" in the C status tracking page.

This amends 510383626fe146e49ae5fa036638e543ce71e5d9.

Added: 
    clang/test/C/C2x/n2508.c

Modified: 
    clang/www/c_status.html

Removed: 
    


################################################################################
diff  --git a/clang/test/C/C2x/n2508.c b/clang/test/C/C2x/n2508.c
new file mode 100644
index 0000000000000..1610d6e17220d
--- /dev/null
+++ b/clang/test/C/C2x/n2508.c
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -verify -std=c2x %s
+
+/* WG14 N2508: partial
+ * Free positioning of labels inside compound statements
+ */
+void test() {
+  {
+  inner:
+  }
+
+  switch (1) {
+  // FIXME: this should be accepted per C2x 6.8.2p2.
+  case 1: // expected-error {{label at end of switch compound statement: expected statement}}
+  }
+
+  {
+  multiple: labels: on: a: line:
+  }
+
+final:
+}
+

diff  --git a/clang/www/c_status.html b/clang/www/c_status.html
index 395bdf5d22da9..f3e0ab6171a17 100644
--- a/clang/www/c_status.html
+++ b/clang/www/c_status.html
@@ -763,7 +763,13 @@ <h2 id="c2x">C2x implementation status</h2>
     <tr>
       <td>Free positioning of labels inside compound statements</td>
       <td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2508.pdf">N2508</a></td>
-      <td class="unreleased" align="center">Clang 16</td>
+        <td class="partial" align="center">
+          <details><summary>Partial</summary>
+            Clang supports labels at the end of compound statements but does
+            not yet support <code>case</code> or <code>default</code> labels at
+            the end of a switch statement's compound block.
+          </details>
+        </td>
     </tr>
     <tr>
       <td>Clarification request for C17 example of undefined behavior</td>


        


More information about the cfe-commits mailing list