www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13028] New: [ICE] CTFE internal error: cannot evalute at

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

          Issue ID: 13028
           Summary: [ICE] CTFE internal error: cannot evalute at compile
                    time
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: safety0ff.bugz gmail.com

Removing the enum b = ___; line it works.
It would be nice if it would work when the parameter is compile-time evaluable.

int foo(int delegate() dg)
{
    enum b = dg();
    return b;
}


int bar(lazy int a)
{
    enum b = a;
    return a;    
}

void main()
{
    static assert(foo(()=>1) == 1);
    static assert(bar(1) == 1);
}

--
Jul 02 2014