struct1.c 947 B

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