aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.8.1/gcc/testsuite/g++.dg/abi/layout1.C
blob: 645ed6acfeeb4d6557e08748be5d31e5a8439ebd (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
25
26
27
28
29
30
31
// Red Hat bugzilla 64535
// Bug: We are allocationg stuff into the tail padding of POD class "A".
// { dg-do run }

struct A
{
  int x;
  char y;
};

struct B : public A {
  virtual void f () {}
  char z;
};

A a = { 21, 42 };
B b;

int
main (void)
{
  b.x = 12;
  b.y = 24;
  b.z = 36;

  A *ap = &b;

  *ap = a;

  return (b.z != 36);
}