Is D2.0 CTFE broken?

Koroskin Denis 2korden+dmd at gmail.com
Thu Jul 17 01:22:00 PDT 2008


CTFE doesn't work for a few releases for me. Consider the following  
example:

int func()
{
     return 0;
}

template copy(int i)
{
     const int copy = i;
}

void main()
{
     const int f = func(); // Error: non-constant expression f = func()
     const int t = copy!(f);
}

Compiles well with DMD1.033 and DMD2.007 and fails with DMD2.013, 2.015,  
2.017. Other versions not tested.
Is it by design or a bug? It's a blocker issue for me.



More information about the Digitalmars-d mailing list