OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [template/] [operator1.C] - Rev 801

Go to most recent revision | Compare with Previous | Blame | View Log

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;
}

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.