Compiled with a recent master DMD version, flags -preview=dip1000.
-----------------------------
@safe void main(){throw *null;}
-----------------------------
The above example fails to compile with this:
-----------------------------
app.d(1): Error: can only throw class objects derived from `Throwable`, not type `noreturn`
-----------------------------
The code example should compile, albeit with a crash at runtime. The bottom type is supposed to convert to any type, including exceptions. It follows that throwing a bottom type should be allowed by the language, resulting in a runtime crash if that code is actually reached.
Comment #1 by robert.schadek — 2024-12-13T19:24:41Z