CTFE Status

Stefan Koch via Digitalmars-d digitalmars-d at puremagic.com
Wed Dec 7 18:40:02 PST 2016


On Thursday, 8 December 2016 at 02:22:31 UTC, Stefan Koch wrote:
> On Thursday, 8 December 2016 at 01:52:13 UTC, Stefan Koch wrote:
>>
>> Array-literals with ctfe-known Variables in them are now 
>> supported;
>> uint[] fn(uint n)
>> {
>>   return [n, n, n];
>> }
>>
>> static assert(fn(3).length == 3);
>> static assert(fn(3)[0] == 3);
>> static assert(fn(3)[1] == 3);
>> static assert(fn(3)[2] == 3);
>
> This works as well with interspersed constant.
> uint[] itrspary(uint n)
> {
>   return [1, n, 3];
> }
>
> static assert(itrspary(7).length == 3);
> static assert(itrspary(7)[0] == 1);
> static assert(itrspary(7)[1] == 7);
> static assert(itrspary(7)[2] == 3);

I fixed the bug in switchStatements (I think.).
It was not a mismatch with dmd's sorting but rather.
My own sloppy block-exit detection.
Using the dmd BlockExit visitor fixed it.


More information about the Digitalmars-d mailing list