Thread overview
[Issue 12101] [CTFE] Can't return struct with closure during CTFE
[Issue 12101] [CTFE] false error, seems to be related to lambda capture in MapResult
Jul 03, 2017
Vladimir Panteleev
Dec 17, 2022
Iain Buclaw
June 09, 2015
https://issues.dlang.org/show_bug.cgi?id=12101

Andrei Alexandrescu <andrei@erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unspecified                 |D2

--
July 03, 2017
https://issues.dlang.org/show_bug.cgi?id=12101

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
                 CC|                            |dlang-bugzilla@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@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.

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=12101

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P3

--