URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Go to most recent revision |
Only display areas with differences |
Details |
Blame |
View Log
Rev 305 |
Rev 338 |
// { dg-do run }
|
// { dg-do run }
|
// GROUPS passed overloading
|
// GROUPS passed overloading
|
extern "C" int printf (const char *, ...);
|
extern "C" int printf (const char *, ...);
|
|
|
struct NoName {
|
struct NoName {
|
|
|
int first;
|
int first;
|
int second;
|
int second;
|
};
|
};
|
|
|
class Casted {
|
class Casted {
|
|
|
public:
|
public:
|
|
|
NoName x;
|
NoName x;
|
double y;
|
double y;
|
|
|
Casted ( int _x , double _y ): y(_y)
|
Casted ( int _x , double _y ): y(_y)
|
{
|
{
|
x.first = _x;
|
x.first = _x;
|
x.second = _x*2;
|
x.second = _x*2;
|
}
|
}
|
|
|
operator NoName() const { return x; }
|
operator NoName() const { return x; }
|
operator double() const { return y; }
|
operator double() const { return y; }
|
};
|
};
|
|
|
int main()
|
int main()
|
{
|
{
|
Casted c(10,12.34);
|
Casted c(10,12.34);
|
|
|
NoName x;
|
NoName x;
|
double y;
|
double y;
|
|
|
x = c;
|
x = c;
|
y = c;
|
y = c;
|
|
|
if (x.first == 10 && x.second == 20 && y == 12.34)
|
if (x.first == 10 && x.second == 20 && y == 12.34)
|
printf ("PASS\n");
|
printf ("PASS\n");
|
else
|
else
|
{ printf ("FAIL\n"); return 1; }
|
{ printf ("FAIL\n"); return 1; }
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.