Template Mixin issue

Christopher Wright dhasenan at gmail.com
Fri Jan 30 04:27:52 PST 2009


Mike L. wrote:
> If the compiler can tell that B!(int) is a type, why can't it tell that it is a child class of A!(int) ?

This is a bug. In template specializations, : means equality. In static 
if, : means convertibility.

So, you can use:
template ADefaults(Type, AType)
{
	static assert (is (AType : A!(Type)));
	Type blah()
		{ return Type.init; }
}

http://d.puremagic.com/issues/show_bug.cgi?id=1715 if you want to vote.


More information about the Digitalmars-d-learn mailing list