expressions of the form is(Type U : Foo!(U)) do not work when Type is derived via inheritance from the template. ----- module iface_specialize; abstract class ACFoo(T) { void init(T); void term(); void blah(); void bleh(); } class CFoo(T) { void init(T) {} void term() {} void blah() {} void bleh() {} } interface Foo(T) { void init(T); } class IsFoo(T) : Foo!(T) { override void init(T x) { } } class IsACFoo(T) : ACFoo!(T) { void init(T x) { } } class IsCFoo(T) : CFoo!(T) { void init(T x) { } } void main() { alias IsFoo!(float) IsFoof; alias IsCFoo!(float) IsCFoof; alias IsACFoo!(float) IsACFoof; // These are ok static if (! is(IsFoof : Foo!(float))) { pragma(msg, "FAIL: IsFoof *is* a Foo!(float)"); } static if (! is(IsCFoof : CFoo!(float))) { pragma(msg, "FAIL: IsCFoof *is* CFoo!(float)"); } static if (! is(IsACFoof : ACFoo!(float))) { pragma(msg, "FAIL: IsACFoof *is* ACFoo!(float)"); } // These fail static if (! is(IsFoof T : Foo!(T))) { pragma(msg, "FAIL: IsFoof *is* a Foo!(T) for some T [float]"); } static if (! is(IsCFoof T : CFoo!(T))) { pragma(msg, "FAIL: IsCFoof *is* a CFoo!(T) for some T [float]"); } static if (! is(IsACFoof T : ACFoo!(T))) { pragma(msg, "FAIL: IsACFoof *is* a ACFoo!(T) for some T [float]"); } }
It also doesn't work with DMD 2.012.
All tests now pass with current dmd (1.068 & 2.053)