is(Type:Type) fails to evaluate to true

silverclaw post_message at newgroup.com
Mon Oct 8 15:40:57 PDT 2007


I picked up the Matrix class I abandoned some months ago and updated it to the latest DMD (2.022). However, on the opMulAssign the following check fails where it should pass:

const Matrix!(Type) opMul(T)(const T multiplier)
{
	static if (is(T:Matrix)) //multiplication by a Matrix
	{ (....) }
	else //multiplication by a scalar
	{ (....) }
}

It used to work on some other compiler version. So, on the main() I made the following code:

(static) if (is(Matrix:Matrix)) writefln("true");
else writefln("false");

always evaluates to false (prints "false") with or without the "static". As you may have noticed, it is a template class:

public class Matrix(Type)

As I said, it used to work, I'm going to try to find out with which DMD. Any suggestions?


More information about the Digitalmars-d-learn mailing list