1*67e74705SXin Li// RUN: %clang_cc1 %s -fobjc-runtime=macosx-fragile-10.5 -fsyntax-only -verify 2*67e74705SXin Li 3*67e74705SXin Li@interface X 4*67e74705SXin Li{ 5*67e74705SXin Li int a : -1; // expected-error{{bit-field 'a' has negative width}} 6*67e74705SXin Li 7*67e74705SXin Li // rdar://6081627 8*67e74705SXin Li int b : 33; // expected-error{{width of bit-field 'b' (33 bits) exceeds width of its type (32 bits)}} 9*67e74705SXin Li 10*67e74705SXin Li int c : (1 + 0.25); // expected-error{{expression is not an integer constant expression}} 11*67e74705SXin Li int d : (int)(1 + 0.25); 12*67e74705SXin Li 13*67e74705SXin Li // rdar://6138816 14*67e74705SXin Li int e : 0; // expected-error {{bit-field 'e' has zero width}} 15*67e74705SXin Li} 16*67e74705SXin Li@end 17*67e74705SXin Li 18*67e74705SXin Li@interface Base { 19*67e74705SXin Li int i; 20*67e74705SXin Li} 21*67e74705SXin Li@end 22*67e74705SXin Li 23*67e74705SXin Li@interface WithBitFields: Base { 24*67e74705SXin Li void *isa; // expected-note {{previous definition is here}} 25*67e74705SXin Li unsigned a: 5; 26*67e74705SXin Li signed b: 4; 27*67e74705SXin Li int c: 5; // expected-note {{previous definition is here}} 28*67e74705SXin Li} 29*67e74705SXin Li@end 30*67e74705SXin Li 31*67e74705SXin Li@implementation WithBitFields { 32*67e74705SXin Li char *isa; // expected-error {{instance variable 'isa' has conflicting type: 'char *' vs 'void *'}} 33*67e74705SXin Li unsigned a: 5; 34*67e74705SXin Li signed b: 4; 35*67e74705SXin Li int c: 3; // expected-error {{instance variable 'c' has conflicting bit-field width}} 36*67e74705SXin Li} 37*67e74705SXin Li@end 38