aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.brendan/overload7.C
blob: 0c39e0d8c21c8cf637951abec8b447b3ef6252e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// GROUPS passed overloading
extern "C" void printf (char *, ...);

struct NoName {
        
        int first;
        int second;
};

class Casted {

  public:

        NoName  x;
        double  y;

        Casted ( int _x , double _y ): y(_y) 
        { 
                x.first = _x;
                x.second = _x*2;
        }
        
        operator NoName() const { return x; }
        operator double() const { return y; }
};

main()
{
        Casted c(10,12.34);

        NoName x;
        double y;

        x = c;
        y = c;

	if (x.first == 10 && x.second == 20 && y == 12.34)
	  printf ("PASS\n");
	else
	  printf ("FAIL\n");
}