139 lines · c
1// Matches2struct S0 {3 int field1;4 float field2;5};6 7struct S0 x0;8 9// Mismatch in field type10struct S1 {11 int field1;12 float field2;13};14 15struct S1 x1;16 17// Mismatch in tag kind.18union S2 { int i; float f; } x2;19 20// Missing fields21struct S3 { int i; float f; } x3;22 23// Extra fields24struct S4 { int i; float f; } x4;25 26// Bit-field matches27struct S5 { int i : 8; unsigned j : 8; } x5;28 29// Bit-field mismatch30struct S6 { int i : 8; unsigned j; } x6;31 32// Bit-field mismatch33struct S7 { int i : 8; unsigned j : 16; } x7;34 35// Incomplete type36struct S8 { int i; float f; } *x8;37 38// Incomplete type39struct S9 *x9;40 41// Incomplete type42struct S10 *x10;43 44// Matches45struct ListNode {46 int value;47 struct ListNode *Next;48} xList;49 50// Mismatch due to struct used internally51struct DeepError {52 int value;53 struct DeeperError { int i; float f; } *Deeper;54} xDeep;55 56// Matches57struct {58 int i;59 float f;60} x11;61 62// Matches63typedef struct {64 int i;65 float f;66} S12;67 68S12 x12;69 70// Mismatch71typedef struct {72 int i; // Mismatch here.73 float f;74} S13;75 76S13 x13;77 78// Matches79struct Unnamed {80 union {81 struct {82 int i;83 } S;84 struct {85 float i;86 } R;87 } U;88} x14;89 90// Matches91struct DeepUnnamed {92 union {93 union {94 struct {95 long i;96 } S;97 struct {98 int i;99 } R;100 } U1;101 union {102 struct {103 long i;104 } S;105 struct {106 float i;107 } T;108 } U2;109 } U;110 struct {111 long i;112 } V;113} x15;114 115// Mismatch due to unnamed struct used internally116struct DeepUnnamedError {117 union {118 union {119 struct {120 long i;121 } S;122 struct {123 int i;124 } R;125 } U1;126 union {127 struct {128 float i; // Mismatch here.129 } S;130 struct {131 float i;132 } T;133 } U2;134 } U;135 struct {136 long i;137 } V;138} x16;139