CTFE Status

Stefan Koch via Digitalmars-d digitalmars-d at puremagic.com
Fri Feb 10 12:12:53 PST 2017


I just encountered a familiar problem again ...

uint fn(uint a)
{
     final switch(a)
     {
         case 1 :
             do
             {
                 a++;
                 if (a == 17) break;
             } while(a < 20);
                 return a;

         case 2 : return 1;
     }
}

static assert(fn(1) == 17); // fails because the return is 20
static assert(fn(2) == 1);

It turns out I forgot use the facility I implemented to handle 
this on DoStatements as well.
This is now fixed.




More information about the Digitalmars-d mailing list