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// rdar://13138459
4
5void *sel_registerName(const char *);
6extern void abort();
7
8@interface NSObject
9+ alloc;
10- init;
11@end
12
13typedef unsigned char BOOL;
14
15@interface Foo : NSObject {
16
17   BOOL  _field1 : 5;
18   BOOL  _field2    : 3;
19}
20
21@property BOOL field1;
22@property BOOL field2;
23@end
24
25@implementation Foo
26
27@synthesize field1 = _field1;
28@synthesize field2 = _field2;
29
30@end
31
32int main()
33{
34  Foo *f = (Foo*)[[Foo alloc] init];
35  f.field1 = 0xF;
36  f.field2 = 0x3;
37  f.field1 = f.field1 & f.field2;
38  if (f.field1 != 0x3)
39    abort ();
40  return 0;
41}
42
43
44