[Issue 15908] New: Implicitly typed lambda inside class "has no value"

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Apr 9 17:39:41 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=15908

          Issue ID: 15908
           Summary: Implicitly typed lambda inside class "has no value"
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: andy.pj.hanson at gmail.com

There is a compile error for an implicitly typed lambda expression inside a
class.

    import std.algorithm : map;
    auto a = [1,2,3].map!(i => i);
    class X {
        static auto b = [1,2,3].map!((int i) => i);
        // /usr/include/dmd/phobos/std/algorithm/iteration.d(455): Error:
this.__lambda4 has no value
        static auto c = [1,2,3].map!(i => i);
    }

`a` and `b` compile just fine, but `c` causes a compile error. (The error
message doesn't indicate what caused it, though.)

--


More information about the Digitalmars-d-bugs mailing list