xref: /llvm-project/clang/test/Rewriter/objc-modern-property-bitfield.m (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
1// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fms-extensions -rewrite-objc %s -o %t-modern-rw.cpp
2// RUN: %clang_cc1 -fsyntax-only -std=gnu++98 -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-modern-rw.cpp
3
4void *sel_registerName(const char *);
5extern void abort();
6
7@interface NSObject
8+ alloc;
9- init;
10@end
11
12typedef unsigned char BOOL;
13
14@interface Foo : NSObject {
15
16   BOOL  _field1 : 5;
17   BOOL  _field2    : 3;
18}
19
20@property BOOL field1;
21@property BOOL field2;
22@end
23
24@implementation Foo
25
26@synthesize field1 = _field1;
27@synthesize field2 = _field2;
28
29@end
30
31int main()
32{
33  Foo *f = (Foo*)[[Foo alloc] init];
34  f.field1 = 0xF;
35  f.field2 = 0x3;
36  f.field1 = f.field1 & f.field2;
37  if (f.field1 != 0x3)
38    abort ();
39  return 0;
40}
41
42
43