Debian Codegraph @

gcc/testsuite/g++.dg/ext/packed2.C

raw
1 // PR c++/10091
2
3 // Original synopsis
4 // Bug: We were dying because in general, B::a doesn't have enough
5 // alignment for us to take its address. But if the B is C::b, it does
6 // have enough alignment, and we should be able to determine that.
7
8 // This only failed on STRICT_ALIGNMENT targets (i.e. not i686)
9
10 // July 2003
11 // packing of non-pods is now only allowed if the non-pod is itself
12 // packed. Also only such pods can be reference bound to non-consts
13
14 struct A {
15 int i;
16
17 A();
18 A(const A&);
19 A& operator=(const A&);
20 } __attribute__ ((packed));
21
22 struct B {
23 A a;
24 } __attribute__ ((packed));
25
26 struct C {
27 B b;
28 int j;
29 };
30
31 void f (A&);
32 void g (C& c)
33 {
34 f (c.b.a);
35 }