In this following example we can call Foo.get even it is not implemented. The program compiles and runs without problems, but shouldn't. When Foo.get is implemented it also never get called. The compiler recognizes the bug when the return type for get isn't a template or interfaces Node and Nodes changes places. module Main; class Bar(T) { } //program compiles but crashes when interface is empty interface Node : Nodes { void print(); } interface Nodes { public: Bar!(Node) get(); } class Foo : Node { public: void print() { } /* //never get called when implemented Bar!(Node) get() { return null; } */ } void main(char[][] args) { Node foo = new Foo; foo.get(); }
Created attachment 169 [details] alternative testcase This is another testcase that show that applications can silently change behavior ,crash or just don't work only by switching the order of declaration of two interfaces. It doesn't matter if the interfaces are defined in another file.
Seems to work fine with DMD 1.047 and DMD 2.032. I haven't tested the additional alternative testcase, though (because of the tango usage).
Fixed in 1.029 or 1.030.