[Issue 12101] [CTFE] Can't return struct with closure during CTFE

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jul 3 14:00:48 PDT 2017


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

Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
                 CC|                            |dlang-bugzilla at thecybershad
                   |                            |ow.net
            Summary|[CTFE] false error, seems   |[CTFE] Can't return struct
                   |to be related to lambda     |with closure during CTFE
                   |capture in MapResult        |

--- Comment #1 from Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> ---
(In reply to Martin Nowak from comment #0)
> Sorry, it's not very reduced, but I don't have time to do this right now.

Reduced:

//////////////// test.d ////////////////
auto makeBox(int value)
{
    struct Box
    {
        int getValue() { return value; }
    }

    return Box();
}

enum value = makeBox(1).getValue();
////////////////////////////////////////

Looks like there is an issue returning closure structs in CTFE.

--


More information about the Digitalmars-d-bugs mailing list