On Monday, 31 October 2016 at 13:29:01 UTC, Stefan Koch wrote:
Hi Guys, since I got a few complaints about giving minor status updates in the announce group, I am opening this thread.

I will start with giving an overview of what works and what does not work.

Currently the only basic type you can do arithmetic on is int.
Altough you can compare longs since a few days.

These are the constructs that will work.

- foreach on static arrays strings and range-foreach (those kinds (0 .. 64)).
- switches (even deeply nested ones)
- for and while loops
- ternary expressions (? :)
- if and else statements (as long as you don't use && and || )
- lables and gotos
- arithmetic expressions as well as post and pre increment and decrement

Constructs that will not work (but are actively worked on)

- assignment to static array cells
- long ulong arithmetic.
- function calls
- dynamic arrays and slices
- pointers
- structs
- && and ||
- sliceing

Constructs that will not work and are futher down the list.

- classes
- closures
- boundschecks
- asserts

Please note that there will probably be bugs all over the place.
So even the working features might not be working completely.

I just fixed a really nasty bug that prevented the following code from working in newCTFE.

int computeFib(int n)
{
    int t = 1;
    int result = 0;

    while(n--)
    {
        result = t - result;
        t = t + result;
    }

   return result;
}

static assert(computeFib(12) == 144);

The line result = t - result is the one triggering the bug.
Because newCTFE broke it down like this
result = t;
result -= result;

This was not found by the compilers testsuite!
I guess we should add it.

Reply via email to