OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.old-deja/] [g++.other/] [inline21.C] - Blame information for rev 699

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 699 jeremybenn
// { dg-do run  }
2
// { dg-options "-O2" }
3
// Origin: suckfish@ihug.co.nz
4
 
5
// DECLARATIONS
6
 
7
struct Record {
8
   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.
18
   Container ( const Record  b) : record(b) {}
19
};
20
 
21
 
22
// TEST FOR CORRECT BEHAVIOR
23
 
24
int myArray[3];
25
int * intp = myArray;
26
 
27
void use_pair (const Container & c)
28
{
29
   *intp++ = c.record.b;
30
}
31
 
32
extern "C" int printf (const char *,...);
33
 
34
int main()
35
{
36
  use_pair (Container (1234));
37
 
38
  if (myArray[0] != 1234)
39
    return 1;
40
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.