newCTFE Status Feburary 2019

Stefan Koch uplink.coder at googlemail.com
Tue Feb 5 22:51:04 UTC 2019


Hi Guys,

I've just fixed interactions between structures and delegates.

making the following code work:

struct S2
{
   int x = 64;
   int[2] a;
}

S2 fn2()
{
     S2 s = S2.init;

     void initS()
     {
         s.x = 1;
         s.a[0] = 2;
         s.a[1] = 3;
     }

     initS();
     return s;
}


static assert(fn2() == S2(1, [2, 3]));


--
There are still a few bugs to be fixed however.
One being broadcast assignment within the nested function.
if you were to write s.a = 2, that should result in s.a == [2,2].
However currently newCTFE will drop that assignment when 
referring to to an outer variable
from within a nested function.

Technically this should not be too hard to fix, but currently I 
can't put my finger on the cause ....


More information about the Digitalmars-d mailing list