[Issue 3762] New: Restrictive functionality for template instance recursive expansion
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jan 31 14:30:07 PST 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3762
Summary: Restrictive functionality for template instance
recursive expansion
Product: D
Version: 2.039
Platform: x86
OS/Version: Windows
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: curoles at yahoo.com
CC: curoles at yahoo.com
--- Comment #0 from Igor Lesik <curoles at yahoo.com> 2010-01-31 14:30:04 PST ---
How to reproduce:
template static_factorial(int n)
{
static if (n == 1)
const static_factorial = 1;
else
const static_factorial = n * static_factorial!(n-1);
}
void main()
{
writefln("502!=%d", static_factorial!(502));
Error: template instance factorial.static_factorial!(2) recursive expansion
Max recursion depth 500 is hardcoded in template.c function
TemplateInstance::semantic() line 3738 if (++nest > 500). While 500 is
reasonable practical limit, it would be nice to be able to control it somehow,
with #pragma for example.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list