Never-returning functions
    Enamex via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Tue Aug  2 08:09:12 PDT 2016
    
    
  
I've tried to write an 'assert function' in D, one that doesn't 
trigger the 'function must return a value or assert' error.
Basically something like:
Never neverReturns() { assert(0); }
or
@noreturn auto neverReturns() { assert(0); }
and
int tryMe(bool f) {
     if(f) return 42;
     else neverReturns();
}
Then have the call on line 2 in `tryMe` be accepted by the 
compiler.
    
    
More information about the Digitalmars-d-learn
mailing list