[dmd-internals] CTFE regression in Git master (bf25caa)

Don Clugston dclugston at googlemail.com
Fri Nov 18 11:59:35 PST 2011


On 18 November 2011 18:35, David Nadlinger <code at klickverbot.at> wrote:
> Some of the changes since the last release caused a regression in CTFE:
> ---
> import std.conv;
> enum short a = 1000;
> enum b = to!string(a);
> ---
> now fails with:
> ---
> CTFE internal error: unsupported assignment cast(uint)cast(int)n /= base
> Assertion failed: (e1->op == TOKarraylength || e1->op == TOKvar || e1->op ==
> TOKdotvar || e1->op == TOKindex || e1->op == TOKslice), function
> interpretAssignCommon, file interpret.c, line 3343.
> ---
>
> As it probably clear to you what's happening here anyway, Don, I didn't
> reduce it any further so far. This is the corresponding source line:
> https://github.com/D-Programming-Language/phobos/blob/master/std/format.d#L1105

Reduced test case. This has never worked in CTFE, so it's a change to
Phobos that exposed it. The fix is simple.

int regress()
{
    ubyte n = 6;
    n /= 2u;
    return n;
}
static assert(regress()==3);



>
> David
> _______________________________________________
> dmd-internals mailing list
> dmd-internals at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-internals
>


More information about the dmd-internals mailing list