1 // RUN: %clang_cc1 -fsyntax-only -verify -x c -std=c11 %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -x c++ -std=c++11 %s
3 // RUN: %clang_cc1 -std=c99 -E -DPP_ONLY=1 %s | FileCheck %s --strict-whitespace
4 // RUN: %clang_cc1 -E -DPP_ONLY=1 %s | FileCheck %s --strict-whitespace
6 // This file contains Unicode characters; please do not "fix" them!
8 extern int x
; // expected-warning {{treating Unicode character as whitespace}}
9 extern int x
; // expected-warning {{treating Unicode character as whitespace}}
11 // CHECK: extern int {{x}}
12 // CHECK: extern int {{x}}
14 #pragma mark ¡Unicode!
16 #define COPYRIGHT Copyright © 2012
18 #define STR(X) XSTR(X)
20 static const char *copyright
= STR(COPYRIGHT
); // no-warning
21 // CHECK: static const char *copyright = "Copyright © {{2012}}";
25 // CHECK: Copyright © {{2012}}
26 CHECK
: The preprocessor should
not complain about Unicode characters like ©
.
37 extern int \u1B4C; // BALINESE LETTER ARCHAIC JNYA - Added in Unicode 14
38 extern int \U00016AA2
; // TANGSA LETTER GA - Added in Unicode 14
39 // This character doesn't have the XID_Start property
40 extern int \U00016AC0
; // TANGSA DIGIT ZERO // expected-error {{expected unqualified-id}}
41 extern int _\U00016AC0
; // TANGSA DIGIT ZERO
43 extern int 🌹
; // expected-error {{unexpected character <U+1F339>}} \
44 expected
-warning
{{declaration does
not declare anything
}}
46 extern int 👷
; // expected-error {{unexpected character <U+1F477>}} \
47 expected
-warning
{{declaration does
not declare anything
}}
49 extern int 👷♀
; // expected-warning {{declaration does not declare anything}} \
50 expected
-error
{{unexpected character
<U
+1F477
>}} \
51 expected
-error
{{unexpected character
<U
+200D
>}} \
52 expected
-error
{{unexpected character
<U
+2640>}}
55 // A 🌹 by any other name....
57 int 🌵
(int 🌻
) { return 🌻
+ 1; }
63 int n;
= 3; // expected-warning {{treating Unicode character <U+037E> as identifier character rather than as ';' symbol}}
64 int *n꞉꞉v
= &n;
; // expected-warning 2{{treating Unicode character <U+A789> as identifier character rather than as ':' symbol}}
65 // expected-warning@-1 {{treating Unicode character <U+037E> as identifier character rather than as ';' symbol}}
66 int v=[=](
auto){
return~x;}()
; // expected-warning 12{{treating Unicode character}}
69 // expected-warning@-1 {{identifier contains Unicode character <U+2060> that is invisible in some environments}}
70 // expected-warning@-2 {{identifier contains Unicode character <U+FEFF> that is invisible in some environments}}
71 // expected-warning@-3 {{identifier contains Unicode character <U+200D> that is invisible in some environments}}
72 int foobar
= 0; // expected-warning {{identifier contains Unicode character <U+200B> that is invisible in some environments}}
73 int x
= foobar
; // expected-error {{undeclared identifier}}
75 int ∣foo
; // expected-error {{unexpected character <U+2223>}}
77 #define ∶ x // expected-error {{macro name must be an identifier}}