1// Special g++ Options: -O2
2// Origin: suckfish@ihug.co.nz
3
4// DECLARATIONS
5
6struct Record {
7   Record (int bb) :
8      b (bb)
9      { }
10   int extra;   // Having an extra member in record is crucial.
11   int b;
12};
13
14struct Container {
15   Record record;
16   // The const on the next line is crucial.
17   Container ( const Record  b) : record(b) {}
18};
19
20
21// TEST FOR CORRECT BEHAVIOR
22
23int myArray[3];
24int * intp = myArray;
25
26void use_pair (const Container & c)
27{
28   *intp++ = c.record.b;
29}
30
31extern "C" int printf (const char *,...);
32
33int main()
34{
35  use_pair (Container (1234));
36
37  if (myArray[0] != 1234)
38    return 1;
39}
40