summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/template/operator1.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/template/operator1.C')
-rw-r--r--gcc/testsuite/g++.dg/template/operator1.C49
1 files changed, 49 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/template/operator1.C b/gcc/testsuite/g++.dg/template/operator1.C
new file mode 100644
index 000000000..402e607d1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/operator1.C
@@ -0,0 +1,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;
+}