bottom type as parameter or local variable, does that make sense?
vit
vit at vit.vit
Fri Jan 14 14:05:25 UTC 2022
On Friday, 14 January 2022 at 13:58:38 UTC, H. S. Teoh wrote:
> On Fri, Jan 14, 2022 at 11:52:04AM +0000, WebFreak001 via
> Digitalmars-d wrote:
>> ```d
> [...]
>> void bar()
>> {
>> noreturn b;
>> writeln("calling");
>> foo(b);
>> }
> [...]
>> ```
>
> Wait, doesn't the DIP say that while declaring a variable of
> type `noreturn` is technically allowed, it should abort at
> runtime as soon as the variable is initialized? Why is program
> actually running past that line??!
>
>
> T
Whith explicit init it works like that:
```d
import std.stdio;
void main(){
noreturn n = noreturn.init;
writeln("bar");
}
```
Print:
```
//Illegal instruction (core dumped)
```
More information about the Digitalmars-d
mailing list