Thread overview
[dmd-internals] CTFE regression in Git master (bf25caa)
Nov 18, 2011
David Nadlinger
Nov 18, 2011
Don Clugston
Nov 18, 2011
David Nadlinger
November 18, 2011
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

David
November 18, 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
>
November 18, 2011
On 11/18/11 8:59 PM, Don Clugston wrote:
> This has never worked in CTFE, so it's a change to
> Phobos that exposed it. The fix is simple.

Oh, you are right, sorry ? I forgot that value formatting was unified since DMD 2.056. In any case, thanks a lot for the quick fix!

David