1 // PR c++/41788 2 // { dg-do run } 3 // { dg-options "-Wpacked -Wno-attributes" } 4 5 extern "C" void abort (); 6 7 struct INNER { fooINNER8 virtual int foo() const { return 1; } 9 } __attribute__ ((packed)); 10 11 struct OUTER { 12 char c; 13 INNER inner; 14 } __attribute__ ((packed)); 15 main()16int main() 17 { 18 OUTER outer; 19 int s = sizeof(outer); 20 int o = (char *)&outer.inner - (char *)&outer; 21 if (s != sizeof (char) + sizeof (void*) 22 || o != sizeof (char)) 23 abort (); 24 } 25