www.digitalmars.com         C & C++   DMDScript  

D - Value template parameters (BUG maybe)

reply Tobias Neukom <tneukom swissonline.ch> writes:
Hi everyone

I'm trying to port my matrix class from C++ to D. The C++ Class makes 
heavy use of templates and I want to do it the same way in D. Why DOES 
the following code compile?

template mat(int ROWS, int COLS) {
	struct matrix {
		float items[ROWS * COLS];
	}
}

void foo(mat!(4,4).matrix x) {
}

int main ( char [] [] args ) {
	mat!(5,6).matrix a;
	foo(a);//	Should NOT work because the type of the 	
//			paramter x is mat!(4,4).matrix
	
     return 0;
}

Cheers Tobias
Jan 13 2004
parent "Walter" <walter digitalmars.com> writes:
It looks like a bug. -Walter
Jan 14 2004