cxx_oper_keyword_ms_compat.cpp revision 6bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89
1// RUN: %clang_cc1 %s -E -fms-compatibility
2
3bool f() {
4  // Check that operators still work before redefining them.
5#if compl 0 bitand 1
6  return true and false;
7#endif
8}
9
10#ifdef and
11#endif
12
13// The second 'and' is a valid C++ operator name for '&&'.
14#if defined and and defined(and)
15#endif
16
17// All c++ keywords should be #define-able in ms mode.
18// (operators like "and" aren't normally, the rest always is.)
19#define and
20#define and_eq
21#define alignas
22#define alignof
23#define asm
24#define auto
25#define bitand
26#define bitor
27#define bool
28#define break
29#define case
30#define catch
31#define char
32#define char16_t
33#define char32_t
34#define class
35#define compl
36#define const
37#define constexpr
38#define const_cast
39#define continue
40#define decltype
41#define default
42#define delete
43#define double
44#define dynamic_cast
45#define else
46#define enum
47#define explicit
48#define export
49#define extern
50#define false
51#define float
52#define for
53#define friend
54#define goto
55#define if
56#define inline
57#define int
58#define long
59#define mutable
60#define namespace
61#define new
62#define noexcept
63#define not
64#define not_eq
65#define nullptr
66#define operator
67#define or
68#define or_eq
69#define private
70#define protected
71#define public
72#define register
73#define reinterpret_cast
74#define return
75#define short
76#define signed
77#define sizeof
78#define static
79#define static_assert
80#define static_cast
81#define struct
82#define switch
83#define template
84#define this
85#define thread_local
86#define throw
87#define true
88#define try
89#define typedef
90#define typeid
91#define typename
92#define union
93#define unsigned
94#define using
95#define virtual
96#define void
97#define volatile
98#define wchar_t
99#define while
100#define xor
101#define xor_eq
102
103// Check this is all properly defined away.
104and
105and_eq
106alignas
107alignof
108asm
109auto
110bitand
111bitor
112bool
113break
114case
115catch
116char
117char16_t
118char32_t
119class
120compl
121const
122constexpr
123const_cast
124continue
125decltype
126default
127delete
128double
129dynamic_cast
130else
131enum
132explicit
133export
134extern
135false
136float
137for
138friend
139goto
140if
141inline
142int
143long
144mutable
145namespace
146new
147noexcept
148not
149not_eq
150nullptr
151operator
152or
153or_eq
154private
155protected
156public
157register
158reinterpret_cast
159return
160short
161signed
162sizeof
163static
164static_assert
165static_cast
166struct
167switch
168template
169this
170thread_local
171throw
172true
173try
174typedef
175typeid
176typename
177union
178unsigned
179using
180virtual
181void
182volatile
183wchar_t
184while
185xor
186xor_eq
187