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