File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ #include < assert.h>
2+
3+ enum {
4+ FIRST_A,
5+ FIRST_B,
6+ };
7+
8+ struct S {
9+ int a;
10+
11+ enum {
12+ SECOND_A,
13+ SECOND_B,
14+ };
15+ };
16+
17+ typedef enum {
18+ TD_A,
19+ TD_B,
20+ } TdEnum;
21+
22+ struct WithAnonField {
23+ int a;
24+ enum {
25+ FIELD_A,
26+ FIELD_B,
27+ } field;
28+ };
29+
30+ int main () {
31+ enum {
32+ THIRD_A,
33+ THIRD_B,
34+ };
35+
36+ assert (FIRST_A == 0 );
37+ assert (FIRST_B == 1 );
38+
39+ assert (S::SECOND_A == 0 );
40+ assert (S::SECOND_B == 1 );
41+
42+ assert (THIRD_A == 0 );
43+ assert (THIRD_B == 1 );
44+
45+ TdEnum td = TD_A;
46+ assert (td == TD_A);
47+ td = TD_B;
48+ assert (td == TD_B);
49+
50+ WithAnonField w;
51+ w.field = WithAnonField::FIELD_A;
52+ assert (w.field == WithAnonField::FIELD_A);
53+ w.field = WithAnonField::FIELD_B;
54+ assert (w.field == WithAnonField::FIELD_B);
55+
56+ return 0 ;
57+ };
Original file line number Diff line number Diff line change 1+ #include <assert.h>
2+
3+ enum {
4+ FIRST_A ,
5+ FIRST_B ,
6+ };
7+
8+ struct S {
9+ int a ;
10+
11+ enum {
12+ SECOND_A ,
13+ SECOND_B ,
14+ };
15+ };
16+
17+ typedef enum {
18+ TD_A ,
19+ TD_B ,
20+ } TdEnum ;
21+
22+ struct WithAnonField {
23+ int a ;
24+ enum {
25+ FIELD_A ,
26+ FIELD_B ,
27+ } field ;
28+ };
29+
30+ int main () {
31+ enum {
32+ THIRD_A ,
33+ THIRD_B ,
34+ };
35+
36+ assert (FIRST_A == 0 );
37+ assert (FIRST_B == 1 );
38+
39+ assert (SECOND_A == 0 );
40+ assert (SECOND_B == 1 );
41+
42+ assert (THIRD_A == 0 );
43+ assert (THIRD_B == 1 );
44+
45+ TdEnum td = TD_A ;
46+ assert (td == TD_A );
47+ td = TD_B ;
48+ assert (td == TD_B );
49+
50+ struct WithAnonField w ;
51+ w .field = FIELD_A ;
52+ assert (w .field == FIELD_A );
53+ w .field = FIELD_B ;
54+ assert (w .field == FIELD_B );
55+
56+ return 0 ;
57+ };
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments