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