Debian Codegraph @

clang/test/SemaObjC/class-bitfield.m

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