compiler in infinite loop

rm roel.mathys at gmail.com
Fri Oct 6 08:42:34 PDT 2006


hi,

this code puts the dmd compiler (v168) into an infinite loop,
and it's caused by having a member in this template that has the same
name as the template.

bye,
roel

===============================================

private import std.stdio;

template TValue(int i:1)
{
	pragma(msg,"last instantiation!!!");
	const int TValue = 1;
}

template TValue(int i)
{	
	pragma(msg,"instantiating...");
	const int TValue = i * TValue!(i-1);
}

void main()
{
	writefln( TValue!(3) );
}



More information about the Digitalmars-d mailing list