www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12101] New: [CTFE] false error, seems to be related to lambda capture in MapResult

https://d.puremagic.com/issues/show_bug.cgi?id=12101

           Summary: [CTFE] false error, seems to be related to lambda
                    capture in MapResult
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: CTFE
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: code dawg.eu


--- Comment #0 from Martin Nowak <code dawg.eu> 2014-02-07 11:01:28 PST ---
cat > bug.d << CODE
import std.algorithm, std.array, std.range;

auto addPrefix(R)(R rng, string prefix)
{
    return rng.map!(a => prefix ~ a)();
}

enum files1 = ["a", "b"].addPrefix("1");
enum files2 = ["c", "d"].addPrefix("2");
enum allFiles = chain(files1, files2).array();
CODE

dmd -c bug.d
----
bug.d(5): Error: variable prefix cannot be read at compile time
----

Sorry, it's not very reduced, but I don't have time to do this right now.
Still wanted to report this.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 07 2014