www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5965] New: [2.053 beta] map rejects a predicate with anon-func and nested func

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5965

           Summary: [2.053 beta] map rejects a predicate with anon-func
                    and nested func
           Product: D
           Version: future
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: cbkbbejeap mailinator.com



22:40:28 PDT ---
-----------------------------------
import std.algorithm;

void main()
{
 int foo(int i) { return i; }

 int[] arr;
 auto x = map!( (int a){return foo(a);} )(arr);
}
-----------------------------------

That worked in 2.052, but fails to compile in 2.053 beta with the message:

test.d(8): Error: delegate std.algorithm.__dgliteral1 cannot access frame of 
function test.main.__dgliteral1

I haven't checked to see if this is an issue with map or with using that func
as a template argument.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 08 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5965


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com



13:28:18 PDT ---
Reduced test case:

template mapx(fun...) if (fun.length >= 1)
{
    int mapx(Range)(Range r)
    {
        return 1;
    }
}

void test()
{
   int foo(int i) { return i; }

   int[] arr;
   auto x = mapx!( function(int a){return foo(a);} )(arr);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 11 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5965


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



20:17:19 PDT ---
https://github.com/D-Programming-Language/dmd/commit/42ee97af67cdf05697d8119dc113ed568b9f2a3c

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 11 2011