[C2x] Claim support for WG14 N2838
authorAaron Ballman <aaron@aaronballman.com>
Fri, 3 Mar 2023 16:56:22 +0000 (11:56 -0500)
committerAaron Ballman <aaron@aaronballman.com>
Fri, 3 Mar 2023 16:57:21 +0000 (11:57 -0500)
This paper clarifies that complete object types need to be smaller than
SIZE_MAX. We already conformed to that requirement, so this adds some
test coverage to prove it.

clang/test/C/C2x/n2838.c [new file with mode: 0644]
clang/www/c_status.html

diff --git a/clang/test/C/C2x/n2838.c b/clang/test/C/C2x/n2838.c
new file mode 100644 (file)
index 0000000..f110fef
--- /dev/null
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -verify -std=c2x %s
+
+/* WG14 N2838: yes
+ * Types and sizes
+ */
+
+char buffer4[0xFFFF'FFFF'FFFF'FFFF'1wb]; /* expected-error {{array is too large (295147905179352825841 elements)}} */
+char buffer3[0xFFFF'FFFF'FFFF'FFFFwb];   /* expected-error {{array is too large (18446744073709551615 elements)}} */
+char buffer2[0x7FFF'FFFF'FFFF'FFFFwb];   /* expected-error {{array is too large (9223372036854775807 elements)}} */
+char buffer1[0x1FFF'FFFF'FFFF'FFFFwb];   /* array is juuuuuust right */
+
+/* The largest object we can create is still smaller than SIZE_MAX. */
+static_assert(0x1FFF'FFFF'FFFF'FFFFwb <= __SIZE_MAX__);
index dcc02e8b05145fcbd4d0c3930fd55857d0490558..20eec37fce3de6f7b347c4d144e96d7847b5c433 100644 (file)
@@ -972,7 +972,7 @@ conformance.</p>
     <tr>
       <td>Types and sizes</td>
       <td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2838.htm">N2838</a></td>
-      <td class="unknown" align="center">Unknown</td>
+      <td class="full" align="center">Yes</td>
     </tr>
     <tr>
       <td>Clarifying integer terms</td>