[clang] [clang][test] Add test for unicode macro replacement (PR #244692)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 20 11:46:04 PST 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Hardik Kumar (hardikxk)
<details>
<summary>Changes</summary>
A macro that contains a unicode > 0x10FFFF limit is mishandled.
Add a test to test for coverage of this behaviour.
closes #<!-- -->125461
---
Full diff: https://github.com/llvm/llvm-project/pull/244692.diff
1 Files Affected:
- (added) clang/test/Preprocessor/illegal-codepoint.cpp (+10)
``````````diff
diff --git a/clang/test/Preprocessor/illegal-codepoint.cpp b/clang/test/Preprocessor/illegal-codepoint.cpp
new file mode 100644
index 0000000000000..bbe3e83b385c1
--- /dev/null
+++ b/clang/test/Preprocessor/illegal-codepoint.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
+
+// https://github.com/llvm/llvm-project/issues/125461
+
+#define Y\U00110000Z() "Y\U00110000Z is an identifier" // expected-warning {{ISO C99 requires whitespace after the macro name}} \
+ // expected-note {{previous definition is here}}
+#define Y\U00110001Z() "Y\U00110001Z is an identifier" // expected-warning {{ISO C99 requires whitespace after the macro name}} \
+ // expected-warning {{'Y' macro redefined}}
+Y\U00110000Z() // expected-error {{character <0x110000> not allowed in an identifier}}
+YZ() // expected-error {{expected function body after function declarator}}
``````````
</details>
https://github.com/llvm/llvm-project/pull/244692
More information about the cfe-commits
mailing list