[clang] 66b540d - [C11] Claim conformance to WG14 N1518 (#133749)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 1 08:45:59 PDT 2025
Author: Aaron Ballman
Date: 2025-04-01T11:45:56-04:00
New Revision: 66b540d861ecc5fef0fc398c9c3590c3a7dc6ff9
URL: https://github.com/llvm/llvm-project/commit/66b540d861ecc5fef0fc398c9c3590c3a7dc6ff9
DIFF: https://github.com/llvm/llvm-project/commit/66b540d861ecc5fef0fc398c9c3590c3a7dc6ff9.diff
LOG: [C11] Claim conformance to WG14 N1518 (#133749)
This paper introduced ranges of valid start and continuation characters
for identifiers. C23 made further changes to these sets.
Added:
clang/test/C/C11/n1518.c
Modified:
clang/www/c_status.html
Removed:
################################################################################
diff --git a/clang/test/C/C11/n1518.c b/clang/test/C/C11/n1518.c
new file mode 100644
index 0000000000000..e950d22b20cf9
--- /dev/null
+++ b/clang/test/C/C11/n1518.c
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -verify=c11,both -std=c11 %s
+// RUN: %clang_cc1 -verify=c23,both -std=c23 %s
+
+/* WG14 N1518: Clang 15
+ * Recommendations for extended identifier characters for C and C++
+ *
+ * This paper effectively adopts UAX #31, which was later officially adopted
+ * for C23 via WG14 N2836 and supersedes N1518.
+ */
+
+// This file takes test cases from clang/test/C/C23/n2836_n2939.c.
+// This file contains Unicode characters; please do not "fix" them!
+
+// This was fine in C11, is now an error in C23.
+extern int ٢; // c23-error {{character <U+0662> not allowed at the start of an identifier}} \
+ c23-warning {{declaration does not declare anything}}
+
+// This was an error in C11 but is an extension in C23.
+extern int ∞; // c11-error {{unexpected character <U+221E>}} \
+ c11-warning {{declaration does not declare anything}} \
+ c23-warning {{mathematical notation character <U+221E> in an identifier is a Clang extension}}
+
+int \u1DC0; // both-error {{expected identifier or '('}}
+int e\u1DC0; // Ok
diff --git a/clang/www/c_status.html b/clang/www/c_status.html
index f4f00ac6dd808..8434ed9ecf6f8 100644
--- a/clang/www/c_status.html
+++ b/clang/www/c_status.html
@@ -1105,7 +1105,7 @@ <h2 id="c11">C11 implementation status</h2>
<tr>
<td>Recommendations for extended identifier characters for C and C++</td>
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1518.htm">N1518</a></td>
- <td class="unknown" align="center">Unknown</td>
+ <td class="full" align="center">Clang 15</td>
</tr>
<tr>
<td>Atomic C1x/C++0x compatibility refinements (1st part only)</td>
More information about the cfe-commits
mailing list