OSDN Git Service

/cp
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / template / operator1.C
1 class test
2 {
3 public:
4  float operator[]( int index )
5  {
6   return testFloat[index];
7  }
8 private:
9  float testFloat[3];
10 };
11
12 template < class typeA > float
13 operator*(
14  typeA a,
15  float b
16 )
17 {
18  return a[0] * b;
19 }
20
21 template < class typeB > float
22 operator*(
23  float a,
24  typeB b
25 )
26 {
27  return a * b[0];
28 }
29
30 template < class typeA, class typeB > float
31 operator*(
32  typeA a,
33  typeB b
34 )
35 {
36  return a[0] * b[0];
37 }
38
39 int main( void )
40 {
41  test aTest;
42  float bTest;
43  float result;
44
45  result = aTest * bTest;
46  result = bTest * aTest;
47
48  return 0;
49 }