struct2.c 907 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // Matches
  2. struct S0 {
  3. int field1;
  4. float field2;
  5. };
  6. struct S0 x0;
  7. // Mismatch in field type
  8. struct S1 {
  9. int field1;
  10. float field2;
  11. };
  12. struct S1 x1;
  13. // Mismatch in tag kind.
  14. union S2 { int i; float f; } x2;
  15. // Missing fields
  16. struct S3 { int i; float f; } x3;
  17. // Extra fields
  18. struct S4 { int i; float f; } x4;
  19. // Bit-field matches
  20. struct S5 { int i : 8; unsigned j : 8; } x5;
  21. // Bit-field mismatch
  22. struct S6 { int i : 8; unsigned j; } x6;
  23. // Bit-field mismatch
  24. struct S7 { int i : 8; unsigned j : 16; } x7;
  25. // Incomplete type
  26. struct S8 { int i; float f; } *x8;
  27. // Incomplete type
  28. struct S9 *x9;
  29. // Incomplete type
  30. struct S10 *x10;
  31. // Matches
  32. struct ListNode {
  33. int value;
  34. struct ListNode *Next;
  35. } xList;
  36. // Mismatch due to struct used internally
  37. struct DeepError {
  38. int value;
  39. struct DeeperError { int i; float f; } *Deeper;
  40. } xDeep;
  41. // Matches
  42. struct {
  43. int i;
  44. float f;
  45. } x11;