[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Preprocessor / cxx_oper_keyword.cpp
bloba66e8904973fa1fa7b0ce98753abd08007e6e858
1 // RUN: %clang_cc1 %s -E -verify -DOPERATOR_NAMES
2 // RUN: %clang_cc1 %s -E -verify -fno-operator-names
4 #ifndef OPERATOR_NAMES
5 //expected-error@+3 {{token is not a valid binary operator in a preprocessor subexpression}}
6 #endif
7 // Valid because 'and' is a spelling of '&&'
8 #if defined foo and bar
9 #endif
11 // Not valid in C++ unless -fno-operator-names is passed:
13 #ifdef OPERATOR_NAMES
14 //expected-error@+2 {{C++ operator 'and' (aka '&&') used as a macro name}}
15 #endif
16 #define and foo
18 #ifdef OPERATOR_NAMES
19 //expected-error@+2 {{C++ operator 'xor' (aka '^') used as a macro name}}
20 #endif
21 #if defined xor
22 #endif
24 // For error recovery we continue as though the identifier was a macro name regardless of -fno-operator-names.
25 #ifdef OPERATOR_NAMES
26 //expected-error@+3 {{C++ operator 'and' (aka '&&') used as a macro name}}
27 #endif
28 //expected-warning@+2 {{and is defined}}
29 #ifdef and
30 #warning and is defined
31 #endif
33 #ifdef OPERATOR_NAMES
34 //expected-error@+2 {{invalid token at start of a preprocessor expression}}
35 #endif
36 #if or
37 #endif
39 #ifdef OPERATOR_NAMES
40 //expected-error@+2 {{invalid token at start of a preprocessor expression}}
41 #endif
42 #if and_eq
43 #endif