gcc/testsuite/g++.old-deja/g++.jason/template5.C
raw| 1 | // { dg-do assemble } |
| 2 | // Bug: g++ fails to compare integer constants properly. |
| 3 | |
| 4 | template <int X, int Y> |
| 5 | struct Matrix { |
| 6 | int base [X] [Y]; |
| 7 | }; |
| 8 | |
| 9 | template <int M,int H,int N> |
| 10 | Matrix<M,N>& Mul(Matrix<M,N>& Q,Matrix<M,H>& A,Matrix<H,N>& B) { |
| 11 | for(int i=0;i<M;i++) { |
| 12 | for(int j=0;j<N;j++) { |
| 13 | Q.base[i][j]=0; |
| 14 | for(int k=0;k<H;k++) { |
| 15 | Q.base[i][j]+=A.base[i][k]*B.base[k][j]; |
| 16 | } |
| 17 | } |
| 18 | } |
| 19 | return Q; |
| 20 | } |
| 21 | |
| 22 | void f () |
| 23 | { |
| 24 | Matrix<2, 3> q; |
| 25 | Matrix<2, 4> a; |
| 26 | Matrix<4, 3> b; |
| 27 | q = Mul (q, a, b); |
| 28 | } |