1// RUN: %clang_cc1 %s -fsyntax-only -std=c99 -verify
2// RUN: %clang_cc1 %s -fsyntax-only -std=c11 -Wc99-compat -verify
3// RUN: %clang_cc1 %s -fsyntax-only -x c++ -std=c++03 -Wc++11-compat -verify
4// RUN: %clang_cc1 %s -fsyntax-only -x c++ -std=c++11 -Wc++98-compat -verify
5
6// Note: This file contains Unicode characters; please do not remove them!
7
8// Identifier characters
9extern char aǶ; // C11, C++11
10extern char aª; // C99, C11, C++11
11extern char a΄; // C++03, C11, C++11
12extern char a๐; // C99, C++03, C11, C++11
13extern char a﹅; // none
14extern char x̀; // C11, C++11. Note that this does not have a composed form.
15
16
17
18
19// Identifier initial characters
20extern char ๐; // C++03, C11, C++11
21extern char ̀; // disallowed initially in C11/C++11, always in C99/C++03
22
23
24
25
26
27
28
29
30#if __cplusplus
31# if __cplusplus >= 201103L
32// C++11
33// expected-warning@9 {{using this character in an identifier is incompatible with C++98}}
34// expected-warning@10 {{using this character in an identifier is incompatible with C++98}}
35// expected-error@13 {{non-ASCII characters are not allowed outside of literals and identifiers}}
36// expected-warning@14 {{using this character in an identifier is incompatible with C++98}}
37// expected-error@21 {{expected unqualified-id}}
38
39# else
40// C++03
41// expected-error@9 {{non-ASCII characters are not allowed outside of literals and identifiers}}
42// expected-error@10 {{non-ASCII characters are not allowed outside of literals and identifiers}}
43// expected-error@13 {{non-ASCII characters are not allowed outside of literals and identifiers}}
44// expected-error@14 {{non-ASCII characters are not allowed outside of literals and identifiers}}
45// expected-error@21 {{non-ASCII characters are not allowed outside of literals and identifiers}} expected-warning@21 {{declaration does not declare anything}}
46
47# endif
48#else
49# if __STDC_VERSION__ >= 201112L
50// C11
51// expected-warning@9 {{using this character in an identifier is incompatible with C99}}
52// expected-warning@11 {{using this character in an identifier is incompatible with C99}}
53// expected-error@13 {{non-ASCII characters are not allowed outside of literals and identifiers}}
54// expected-warning@14 {{using this character in an identifier is incompatible with C99}}
55// expected-warning@20 {{starting an identifier with this character is incompatible with C99}}
56// expected-error@21 {{expected identifier}}
57
58# else
59// C99
60// expected-error@9 {{non-ASCII characters are not allowed outside of literals and identifiers}}
61// expected-error@11 {{non-ASCII characters are not allowed outside of literals and identifiers}}
62// expected-error@13 {{non-ASCII characters are not allowed outside of literals and identifiers}}
63// expected-error@14 {{non-ASCII characters are not allowed outside of literals and identifiers}}
64// expected-error@20 {{expected identifier}}
65// expected-error@21 {{non-ASCII characters are not allowed outside of literals and identifiers}} expected-warning@21 {{declaration does not declare anything}}
66
67# endif
68#endif
69