CTFE Status

Stefan Koch via Digitalmars-d digitalmars-d at puremagic.com
Fri Nov 18 09:21:10 PST 2016


On Friday, 18 November 2016 at 15:09:02 UTC, Stefan Koch wrote:

> I just fixed the bug with multiple ArraysLiterals as arguments.
This means the following code will now compile and properly 
execute:

uint Sum3Arrays (uint[] a1, uint[] a2, uint[] a3)
{
   uint result;
   for(int i; i != a1.length; i++)
   {
     result += a1[i];
   }
   for(int i; i != a2.length; i++)
   {
     result += a2[i];
   }
   for(int i; i != a3.length; i++)
   {
     result += a3[i];
   }

   return result;
}

static assert(Sum3Arrays([2,3],[],[]) == 5);
static assert(Sum3Arrays([2],[],[3]) == 5);
static assert(Sum3Arrays([3],[1],[1]) == 5);


More information about the Digitalmars-d mailing list