CTFE Status 2

Stefan Koch via Digitalmars-d digitalmars-d at puremagic.com
Sat May 20 09:07:30 PDT 2017


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

So I just verified that the following code runs fine with newCTFE.

int[2] aaa2(bool b1, bool b2, bool b3)
{
   int x = 0;
   if (b1 && ++x && b2 && x++ && b3 && x++)
   {
     return [x, 1];
   }
   else
   {
     return [x, 0];
   }
}

static assert(aaa2(1, 0, 1) == [1, 0]);
static assert(aaa2(1, 1, 1) == [3, 1]);
static assert(aaa2(0, 0, 1) == [0, 0]);



More information about the Digitalmars-d mailing list