Template Mixin issue

Mike L. mike.linford at gmail.com
Thu Jan 29 22:04:49 PST 2009


Hello,

I was wondering why the following does not work:

interface A(Type)
	{ Type blah(); }

template ADefaults(Type, AType : A!(Type))
{
	Type blah()
		{ return Type.init; }
}

class B(Type) : A!(Type)
	{ mixin ADefaults!(Type, B!(Type)); }

void main()
	{ auto x = new B!(int)(); }

It gives the error: test.d(11): mixin ADefault!(int,B) does not match any template declaration

However, it will compile if you change the ADefaults header to:

template ADefaults(Type, AType)

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) ?


More information about the Digitalmars-d-learn mailing list