newCTFE Status Janurary 2018

Stefan Koch uplink.coder at googlemail.com
Wed Jan 30 14:22:42 UTC 2019


On Monday, 28 January 2019 at 17:35:12 UTC, H. S. Teoh wrote:
> On Sat, Jan 26, 2019 at 09:52:58PM +0000, Stefan Koch via 
> Digitalmars-d wrote:
>> On Sunday, 13 January 2019 at 14:47:59 UTC, Stefan Koch wrote:
>> > [ ... ]
>> 
>> Another small update: I've just fixed problems with 
>> class-constructor and vtbl handling.
> [...]
>
> Good to hear progress is still happening!  Still looking 
> forward to newCTFE landing in master, whenever that will be.
>
>
> T

I am proud to announce that the class-layout seems to work so far.

alias twice = long; alias once = int;
class B {once more = 0x123; twice the_fun = 0xFFF;}

class C : B
{
   int a = 12; int b = 13; int c = 14;

   final int[5] toArray()
   {
     int[5] arr;
     arr = [a, b, c, cast(int) more, cast(int) the_fun];
     return arr;
   }

}

immutable int[5] expectedData = [12, 13, 14, 0x123, 0xFFF];

auto testLayout()
{
     auto c = new C();
     // currently default ctors don't work
     // therefore we need to do this by hand
     c.a = 12; c.b = 13; c.c = 14;
     c.the_fun = 0xFFF;
     c.more = 0x123;

     return c.toArray;
}

static assert (() { return testLayout() == expectedData; } ());
// passes


More information about the Digitalmars-d mailing list