"I told you so": noreturn sucks a leech and has virtually no utility

MoonlightSentinel moonlightsentinel at disroot.org
Fri Oct 15 19:09:37 UTC 2021


On Friday, 15 October 2021 at 18:52:31 UTC, Basile B. wrote:
> No, you can use it everywhere a Type can be used: cast to type, 
> TemplateTypeParameter, VarDeclaration type, etc. And most of 
> the time this is obviously not useful and has to be rejected, 
> i.e during the semantic, i.e by the front-end.

That's actually not the intention of the DIP, only a few usages 
of `noreturn` are treated as an compiler error. E.g. `noreturn 
var` is fine as long as the code never accesses the variable - 
which is useful for templated code like `auto foo = 
possiblyNoreturnFunc()`.



More information about the Digitalmars-d mailing list