This code:

import std.stdio;

int very_very_long_function(in int k)
{
        if (!__ctfe) writeln("Can't use ctfe!");
        return k/2;
}

void main()
{
        enum first = very_very_long_function(10);
        writeln("First is ", first);

        auto second = very_very_long_function(12);
        writeln("Second is ", second);

        auto third = first;
        third += 1;
        writeln("Third is ", third);
}

Why second init doesn't work with CTFE? It could be something like third, but with one less copy. What am I missing?

Reply via email to