Skip to content

[C11] Claim conformance to WG14 N1518 #133749

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions clang/test/C/C11/n1518.c
Original file line number Diff line number Diff line change
@@ -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}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a test that int \u1DC0 is not valid but e\u1DC0 is

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!


int \u1DC0; // both-error {{expected identifier or '('}}
int e\u1DC0; // Ok
2 changes: 1 addition & 1 deletion clang/www/c_status.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Loading