summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/template/operator1.C
blob: 402e607d1e4fd789b9eebe7033cc25733e0f16b7 (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
42
43
44
45
46
47
48
49
class test
{
public:
 float operator[]( int index )
 {
  return testFloat[index];
 }
private:
 float testFloat[3];
};

template < class typeA > float
operator*(
 typeA a,
 float b
)
{
 return a[0] * b;
}

template < class typeB > float
operator*(
 float a,
 typeB b
)
{
 return a * b[0];
}

template < class typeA, class typeB > float
operator*(
 typeA a,
 typeB b
)
{
 return a[0] * b[0];
}

int main( void )
{
 test aTest;
 float bTest;
 float result;

 result = aTest * bTest;
 result = bTest * aTest;

 return 0;
}