www.digitalmars.com         C & C++   DMDScript  

D - Segfault in compiler

linux dmd v0.71

the following code causes a seg fault
(cyclic class in template)

template TreeWalk( W, F ) {
	class BaseFactory : F {
		alias W delegate( F, ClassInfo ) getWalkDelegate;
		W getFrom( getWalkDelegate func, Object o ) {
			return func( this, o.classinfo );
		}
	}
}
class Walker { }
class Factory : instance TreeWalk( Walker, Factory ).BaseFactory {
	Walker getWalker( Factory f, ClassInfo ci ) { return null; }
}

int main( char[][] args ) {
	Factory f = new Factory();
	Walker w = f.getFrom( f.getWalker, f );
	return w.classinfo.name.length;
}
Sep 14 2003