[Issue 3869] Unreasonable error without line number: "recursive template expansion"

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 4 01:24:15 PST 2010


http://d.puremagic.com/issues/show_bug.cgi?id=3869


Stewart Gordon <smjg at iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid, spec


--- Comment #4 from Stewart Gordon <smjg at iname.com> 2010-03-04 01:24:00 PST ---
Thinking about it now, I think what actually happens is that DMD looks ahead at
the effect of continuing the sequence

sum!(base, base)
sum!(base, sum!(base, base))
sum!(base, sum!(base, sum!(base, base)))

just in case, in order to avoid eating up memory unboundedly and bringing the
system to its knees should this infinite sequence continue.

Trouble is I'm not sure that there's a general way to check in advance whether
the sequence continues, short of solving the halting problem.  But one possible
rule that would cover this case is that, if a template is defined within a
template, then to trigger an infinite recursion error the definition must
instantiate both the outer template and the inner template within this new
instance's scope.

The relevant bit of the spec doesn't forbid what you're doing, so technically
this is rejects-valid.  At the same time, it might be somewhere where the spec
wants looking at.

-- 
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