Skip to content

Commit 66b540d

Browse files
authored
[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.
1 parent 58551fa commit 66b540d

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

clang/test/C/C11/n1518.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// RUN: %clang_cc1 -verify=c11,both -std=c11 %s
2+
// RUN: %clang_cc1 -verify=c23,both -std=c23 %s
3+
4+
/* WG14 N1518: Clang 15
5+
* Recommendations for extended identifier characters for C and C++
6+
*
7+
* This paper effectively adopts UAX #31, which was later officially adopted
8+
* for C23 via WG14 N2836 and supersedes N1518.
9+
*/
10+
11+
// This file takes test cases from clang/test/C/C23/n2836_n2939.c.
12+
// This file contains Unicode characters; please do not "fix" them!
13+
14+
// This was fine in C11, is now an error in C23.
15+
extern int ٢; // c23-error {{character <U+0662> not allowed at the start of an identifier}} \
16+
c23-warning {{declaration does not declare anything}}
17+
18+
// This was an error in C11 but is an extension in C23.
19+
extern int ∞; // c11-error {{unexpected character <U+221E>}} \
20+
c11-warning {{declaration does not declare anything}} \
21+
c23-warning {{mathematical notation character <U+221E> in an identifier is a Clang extension}}
22+
23+
int \u1DC0; // both-error {{expected identifier or '('}}
24+
int e\u1DC0; // Ok

clang/www/c_status.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,7 @@ <h2 id="c11">C11 implementation status</h2>
11051105
<tr>
11061106
<td>Recommendations for extended identifier characters for C and C++</td>
11071107
<td><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1518.htm">N1518</a></td>
1108-
<td class="unknown" align="center">Unknown</td>
1108+
<td class="full" align="center">Clang 15</td>
11091109
</tr>
11101110
<tr>
11111111
<td>Atomic C1x/C++0x compatibility refinements (1st part only)</td>

0 commit comments

Comments
 (0)