[Issue 18199] Error with lambda in struct initializer

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 17 16:51:06 UTC 2018


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

John Belmonte <john at neggie.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |john at neggie.net

--- Comment #2 from John Belmonte <john at neggie.net> ---
The memberName:expression variant of initialization is also affected:

struct Foo {
    int function(int) bar;
}

static Foo foo = {
    bar : function(x) { return 2 * x; },  // broken
    //bar : (x) => 2 * x,  // works
};

This seems to be a parsing issue where the struct initializer can't handle
nested curly brackets.

--


More information about the Digitalmars-d-bugs mailing list