September 11, 2007 [Issue 1492] New: With recursive func definition, gdc evaluates too often | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=1492 Summary: With recursive func definition, gdc evaluates too often Product: DGCC aka GDC Version: 0.24 Platform: PC OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: glue layer AssignedTo: dvdfrdmn@users.sf.net ReportedBy: default_357-line@yahoo.de Take the following program: import std.stdio, std.bind; template SR(T...) { typedef SR!(T) delegate(T) SR; } SR!(int) whee(int foo, int depth=1) { writefln(depth, ", foo is ", foo); return cast(SR!(int))bind(&whee, _0, depth+1).ptr; } void main() { whee(23)(42)(69); } What would be expected here is the following output: 1, foo is 23 2, foo is 42 3, foo is 69 What I get, however, is 1, foo is 23 1, foo is 23 2, foo is 42 1, foo is 23 1, foo is 23 2, foo is 42 3, foo is 69 It seems as if GDC evaluates the first function (1), then evaluates it again to get the second function (1 2), then does the whole thing again to get the third function. This, of course, slightly breaks the code. :) --downs -- |
September 14, 2007 [Issue 1492] With recursive func definition, gdc evaluates too often | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1492 dvdfrdmn@users.sf.net changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #1 from dvdfrdmn@users.sf.net 2007-09-14 00:13 ------- Fixed in svn rev 159 / release 0.25 -- |
Copyright © 1999-2021 by the D Language Foundation