Clang Project

clang_source_code/test/Headers/ms-cppoperkey1.cpp
1// RUN: %clang_cc1 \
2// RUN:     -fms-compatibility -x c++-cpp-output \
3// RUN:     -ffreestanding -fsyntax-only -Werror \
4// RUN:     %s -verify
5
6
7# 1 "t.cpp"
8# 1 "query.h" 1 3 4
9// MS header <query.h> uses operator keyword as field name.  
10// Compile without syntax errors.
11struct tagRESTRICTION
12  {
13   union _URes 
14     {
15       int or; // Note use of cpp operator token
16     } res;
17  };
18   ;
19
20int aa ( int x)
21{
22  // In system header code, treat operator keyword as identifier.
23  if ( // expected-note{{to match this '('}}
24    x>1 or x<0) return 1; // expected-error{{expected ')'}}
25  else return 0;  
26}
27
28