OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [g++.old-deja/] [g++.other/] [inline21.C] - Diff between revs 305 and 384

Only display areas with differences | Details | Blame | View Log

Rev 305 Rev 384
// { dg-do run  }
// { dg-do run  }
// { dg-options "-O2" }
// { dg-options "-O2" }
// Origin: suckfish@ihug.co.nz
// Origin: suckfish@ihug.co.nz
// DECLARATIONS
// DECLARATIONS
struct Record {
struct Record {
   Record (int bb) :
   Record (int bb) :
      b (bb)
      b (bb)
      { }
      { }
   int extra;   // Having an extra member in record is crucial.
   int extra;   // Having an extra member in record is crucial.
   int b;
   int b;
};
};
struct Container {
struct Container {
   Record record;
   Record record;
   // The const on the next line is crucial.
   // The const on the next line is crucial.
   Container ( const Record  b) : record(b) {}
   Container ( const Record  b) : record(b) {}
};
};
// TEST FOR CORRECT BEHAVIOR
// TEST FOR CORRECT BEHAVIOR
int myArray[3];
int myArray[3];
int * intp = myArray;
int * intp = myArray;
void use_pair (const Container & c)
void use_pair (const Container & c)
{
{
   *intp++ = c.record.b;
   *intp++ = c.record.b;
}
}
extern "C" int printf (const char *,...);
extern "C" int printf (const char *,...);
int main()
int main()
{
{
  use_pair (Container (1234));
  use_pair (Container (1234));
  if (myArray[0] != 1234)
  if (myArray[0] != 1234)
    return 1;
    return 1;
}
}
 
 

powered by: WebSVN 2.1.0

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