8 Basic properties and usage mentioned in the DIP:
9 https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1034.md
12 alias noreturn
= typeof(*null);
13 pragma(msg
, noreturn
);
15 static assert(!is(noreturn
== void));
18 // static assert(is( typeof([]) == noreturn[] ));
19 // static assert(is( typeof([][0]) == noreturn ));
21 static assert(is( typeof(assert(0)) == noreturn
));
24 // static assert(is( typeof(throw new Exception()) == noreturn ));
26 static assert(is(noreturn
== noreturn
));
27 static assert(!is(noreturn
== const noreturn
));
28 static assert(is(noreturn
: const noreturn
));
30 static assert(!is(noreturn
== int));
31 static assert(is(noreturn
: int));
34 static assert(is(noreturn
[] : int[]));
35 static assert(is(noreturn
* : int*));
36 static assert(is(noreturn
function() : int function()));
37 static assert(is(noreturn
delegate() : int delegate()));
39 // Reject inverse conversions
40 static assert(!is(int[] : noreturn
[]));
41 static assert(!is(int* : noreturn
*));
42 static assert(!is(int function() : noreturn
function()));
43 static assert(!is(int delegate() : noreturn
delegate()));
45 static assert(noreturn
.mangleof
== "Nn"); // Changed from b due to conflicts with bool
46 static assert(noreturn
.sizeof
== 0);
47 static assert(noreturn
.alignof
== 0);
49 static assert((noreturn
*).sizeof
== (int*).sizeof
);
50 static assert((noreturn
[]).sizeof
== (int[]).sizeof
);
52 static assert(is(typeof(noreturn
.init
) == noreturn
));
53 static assert(is(typeof((const noreturn
).init
) == const noreturn
));
54 static assert(is(typeof((immutable noreturn
).init
) == immutable noreturn
));
55 static assert(is(typeof((shared noreturn
).init
) == shared noreturn
));
58 noreturn
exits(int* p
)
61 assert(false); // *p could be valid
66 noreturn
pureexits() @nogc nothrow pure @safe { assert(0); }
68 noreturn
callpureexits() { pureexits(); }
70 noreturn
returnExits()
99 __gshared noreturn globalNoreturn
;
101 template CreateTLS(A
)
108 alias Tnr
= CreateTLS
!noreturn
;
110 void* a2
= &tlsNoreturn
;
111 void* a3
= &globalNoreturn
;
112 return a1
< a2 ? a2
: a3
;