Bug 23365 – Throwing the bottom value should be allowed

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-09-24T11:20:55Z
Last change time
2024-12-13T19:24:41Z
Assigned to
No Owner
Creator
Ate Eskola
Moved to GitHub: dmd#20154 →

Comments

Comment #0 by Ajieskola — 2022-09-24T11:20:55Z
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
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20154 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB