Bug 4072 – Stack overflow on recursive template expansion inside contract

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2010-04-08T06:18:00Z
Last change time
2015-06-09T01:27:41Z
Keywords
ice-on-invalid-code, patch
Assigned to
nobody
Creator
clugdbug

Comments

Comment #0 by clugdbug — 2010-04-08T06:18:01Z
void bug4072(T)(T x) if (is(typeof(bug4072(x)))) {} static assert(!is(typeof(bug4072(7)))); ----- PATCH: template.c line 1421. ----------------------------------- Objects dedargs; + static int nest = 0; + if (++nest > 300) + { + global.gag = 0; // ensure error message gets printed + error("recursive expansion"); + if (sc->tinst) sc->tinst->printInstantiationTrace(); + fatal(); + } m = td->deduceFunctionTemplateMatch(loc, targsi, ethis, fargs, &dedargs); + --nest; //printf("deduceFunctionTemplateMatch = %d\n", m); if (!m) // if no match continue;
Comment #1 by bugzilla — 2010-04-08T13:59:47Z
changeset 432
Comment #2 by clugdbug — 2010-04-09T13:43:37Z
Fixed DMD2.043.