Nested function bug?

2012-03-30 Thread Ed McCardell
I ran into a strange and hard-to-describe problem with nested functions closing over the argument to their enclosing function. When a nested function (A) returns the value of another nested function (B) that returns a parameter of the enclosing function (C), and when (A) is returned from (C)

Re: Nested function bug?

2012-03-30 Thread Walter Bright
On 3/30/2012 1:13 PM, Ed McCardell wrote: I ran into a strange and hard-to-describe problem with nested functions closing over the argument to their enclosing function. When a nested function (A) returns the value of another nested function (B) that returns a parameter of the enclosing function

Re: Nested function bug?

2012-03-30 Thread Andrej Mitrovic
On 3/30/12, Ed McCardell wrote: > The code below demonstrates this (using DMD 2.058, no optimizations). Is > this a bug? You mean the result is 55 when you uncomment "return &nested;"? All asserts pass for me when I use that return. Otherwise when using "return &escaping;" I get: 1244764 1244764

Re: Nested function bug?

2012-03-30 Thread Ed McCardell
On 03/30/2012 04:51 PM, Andrej Mitrovic wrote: You mean the result is 55 when you uncomment "return&nested;"? All asserts pass for me when I use that return. Otherwise when using "return&escaping;" I get: 1244764 1244764 4202631 2.058 win32. On 64-bit linux, the first two asserts always pass

Re: Nested function bug?

2012-03-30 Thread Ed McCardell
On 03/30/2012 04:45 PM, Walter Bright wrote: On 3/30/2012 1:13 PM, Ed McCardell wrote: The code below demonstrates this (using DMD 2.058, no optimizations). Is this a bug? Looks like one. Please report this to http://d.puremagic.com/issues/enter_bug.cgi?product=D Done: http://d.puremagic.c