March 31, 2005 Minor bug in dmd | ||||
---|---|---|---|---|
| ||||
It hangs on infinite template recursion recursion. For example:
template factorial(int n)
{
enum { factorial = n* .factorial!(n-1) }
}
template factorial(int n : 1)
{
enum { factorial = 1 }
}
void test()
{
printf("%d\n", factorial!(-4)); // hangs
}
In gnu g++ it is solved by limiting recursion level.
--
Vladimir
|
Copyright © 1999-2021 by the D Language Foundation