Fixing the issue with "Statement unreachable"

Walter Bright newshound2 at digitalmars.com
Thu Apr 30 06:00:45 UTC 2020


I guessed at what was necessary to finish the example:

-------------
bool test()
{

static if(condA)
{
    static if(condB)
    {
       static if(NEW_CONDITION) return true;
       else static if(condC)
          if(funA()) return true;
       else static if(condD)
          if(funB()) return true;
       else
          if(funC()) return true;
    }
    else static if(condD)
       if(funD()) return true;
    else
       if(funE()) return true;
}

return false;
}

enum bool condA = true, condB = true, condC = true, condD = true;
enum NEW_CONDITION = true;
bool funA();
bool funB();
bool funC();
bool funD();
bool funE();
----------------------

which compiles without error. Evidently, your example must be different from 
this. Please post a complete example.


More information about the Digitalmars-d mailing list