compiler in infinite loop

rm roel.mathys at gmail.com
Fri Oct 6 09:27:40 PDT 2006


but this will work,
so it's the specialisation that is troubling

bye,
rm

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

private import std.stdio;

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

template TValue(int i)
{
	static if (i==2)	pragma(msg,"instantiating ... 2");
	static if (i==3)	pragma(msg,"instantiating ... 3");
	static if (i==4)	pragma(msg,"instantiating ... 4");
	static if (i==5)	pragma(msg,"instantiating ... 5");

	static if (i==1)
		const int TValue = 1;
	else
		const int TValue = i * TValue!(i-1);
}

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



More information about the Digitalmars-d mailing list