CTFE Status 2

Stefan Koch via Digitalmars-d digitalmars-d at puremagic.com
Mon Apr 10 13:49:58 PDT 2017


On Thursday, 16 February 2017 at 21:05:51 UTC, Stefan Koch wrote:
> [ ... ]

Hi Guys :)

I am currently fixing a bug involving complex members of structs
(where complex means (slice, struct, array or pointer))
I did expect them to be broken ...
but not to be _that_ broken :)

struct S
{
     uint[] slice;
}

uint fn()
{
   S s;
   s.slice.length = 12;
   return cast(uint)s.slice.length;
}

static assert(fn() == 12);
This code will not work because s.slice has no elementType :)
(which does not mean it has the s.slice[0] has the type void)
newCTFE literally looses the type information somewhere.

And people wonder why I don't like mondays :)


More information about the Digitalmars-d mailing list