bottom type as parameter or local variable, does that make sense?

Timon Gehr timon.gehr at
Sat Jan 15 11:10:43 UTC 2022

On 15.01.22 12:02, Tejas wrote:
> Not to put words in HS's mouth, but I think the reason why simply 
> declaring the `noreturn` variable should lead to initialisation is 
> because that's how _all_ variable declarations in D behave, unless you 
> disable default initialisation, at which point it's a compiler error to 
> simply declare the variable.
> ...

Exactly. Unless.

> `noreturn` not default initializing is therefore a special case, which I 
> feel is undesirable

Maybe, but why is it more desirable to pretend that the empty type can 
be default-initialized? You can still declare noreturn variables with an 
explicit initializer, but it seems a bit shady to make `assert(0)` the 
default of anything.

More information about the Digitalmars-d mailing list