1  /* { dg-do compile } */
       2  
       3  struct unpacked
       4  {
       5    int i;
       6    char c;
       7  };
       8  
       9  #pragma pack(1)
      10  
      11  struct packed
      12  {
      13    int i;
      14    char c;
      15  };
      16  
      17  struct packed_contains_unpacked
      18  {
      19    char c;
      20    struct unpacked uuuu;  /* This should generate an error message.  */
      21  }; 			/* { dg-error "unpacked structure/union inside a packed struct" "XFAILed until patch for generic GCC structure layout code is accepted" { xfail rx-*-* } } */
      22  
      23  union contains_unpacked
      24  {
      25    char c;
      26    struct unpacked uuuu;  /* This should not.  */
      27  };
      28  
      29  struct packed_contains_packed
      30  {
      31    char c;
      32    struct packed ppppp;   /* This should not.  */
      33  };
      34  
      35  #pragma pack()
      36  
      37  struct unpacked_contains_packed
      38  {
      39    char c;
      40    struct packed p;
      41  };
      42  
      43  struct unpacked_contains_unpacked
      44  {
      45    char c;
      46    struct unpacked u;
      47  };
      48  
      49  
      50  int s1 = sizeof (struct unpacked);
      51  int s2 = sizeof (struct packed);
      52  int s3 = sizeof (struct packed_contains_unpacked);
      53  int s4 = sizeof (struct packed_contains_packed);
      54  int s5 = sizeof (struct unpacked_contains_packed);
      55  int s6 = sizeof (struct unpacked_contains_unpacked);