URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 149 |
Rev 154 |
// { dg-do run }
|
// { dg-do run }
|
// { dg-options -Wold-style-cast }
|
// { dg-options -Wold-style-cast }
|
|
|
// Copyright (C) 2003 Free Software Foundation, Inc.
|
// Copyright (C) 2003 Free Software Foundation, Inc.
|
// Contributed by Nathan Sidwell 22 Apr 2003
|
// Contributed by Nathan Sidwell 22 Apr 2003
|
|
|
// DR273 POD can have an operator&, offsetof is still required to work
|
// DR273 POD can have an operator&, offsetof is still required to work
|
|
|
#include
|
#include
|
|
|
struct POD1
|
struct POD1
|
{
|
{
|
int m;
|
int m;
|
|
|
void *operator& () const {return 0;} // yes, still a pod!
|
void *operator& () const {return 0;} // yes, still a pod!
|
};
|
};
|
|
|
struct POD2
|
struct POD2
|
{
|
{
|
int m;
|
int m;
|
};
|
};
|
|
|
void *operator& (POD2 const &) {return 0;} // ouch!
|
void *operator& (POD2 const &) {return 0;} // ouch!
|
|
|
struct POD3
|
struct POD3
|
{
|
{
|
int prefix;
|
int prefix;
|
|
|
POD1 m;
|
POD1 m;
|
};
|
};
|
|
|
struct POD4
|
struct POD4
|
{
|
{
|
int prefix;
|
int prefix;
|
|
|
POD1 m;
|
POD1 m;
|
};
|
};
|
|
|
int main ()
|
int main ()
|
{
|
{
|
if (offsetof (POD3, m) != sizeof (int))
|
if (offsetof (POD3, m) != sizeof (int))
|
return 1;
|
return 1;
|
if (offsetof (POD4, m) != sizeof (int))
|
if (offsetof (POD4, m) != sizeof (int))
|
return 2;
|
return 2;
|
return 0;
|
return 0;
|
}
|
}
|
|
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.