summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/abi/packed1.C
blob: 834537532e295cd37871547de49d6797fdda0fd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// PR c++/41788
// { dg-do run }
// { dg-options "-Wpacked -Wno-attributes" }

extern "C" void abort ();

struct INNER {
  virtual int foo() const { return 1; }
} __attribute__ ((packed));

struct OUTER {
  char c;
  INNER inner;
} __attribute__ ((packed));

int main()
{
  OUTER outer;
  int s = sizeof(outer);
  int o = (char *)&outer.inner - (char *)&outer;
  if (s != sizeof (char) + sizeof (void*)
      || o != sizeof (char))
    abort ();
}