| 1 |
// { dg-do run } |
| 2 |
// { dg-additional-options "-fexcess-precision=fast" } |
| 3 |
// GROUPS passed overloading |
| 4 |
extern "C" int printf (const char *, ...); |
| 5 |
|
| 6 |
struct NoName { |
| 7 |
|
| 8 |
int first; |
| 9 |
int second; |
| 10 |
}; |
| 11 |
|
| 12 |
class Casted { |
| 13 |
|
| 14 |
public: |
| 15 |
|
| 16 |
NoName x; |
| 17 |
double y; |
| 18 |
|
| 19 |
Casted ( int _x , double _y ): y(_y) |
| 20 |
{ |
| 21 |
x.first = _x; |
| 22 |
x.second = _x*2; |
| 23 |
} |
| 24 |
|
| 25 |
operator NoName() const { return x; } |
| 26 |
operator double() const { return y; } |
| 27 |
}; |
| 28 |
|
| 29 |
int main() |
| 30 |
{ |
| 31 |
Casted c(10,12.34); |
| 32 |
|
| 33 |
NoName x; |
| 34 |
double y; |
| 35 |
|
| 36 |
x = c; |
| 37 |
y = c; |
| 38 |
|
| 39 |
if (x.first == 10 && x.second == 20 && y == 12.34) |
| 40 |
printf ("PASS\n"); |
| 41 |
else |
| 42 |
{ printf ("FAIL\n"); return 1; } |
| 43 |
} |