[Issue 12101] New: [CTFE] false error, seems to be related to lambda capture in MapResult

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Feb 7 11:01:30 PST 2014


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 at puremagic.com
        ReportedBy: code at dawg.eu


--- Comment #0 from Martin Nowak <code at 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: -------


More information about the Digitalmars-d-bugs mailing list