digitalmars.D.bugs - [Issue 23063] New: It is possible to return a noreturn value
- d-bugmail puremagic.com (30/30) Apr 27 2022 https://issues.dlang.org/show_bug.cgi?id=23063
https://issues.dlang.org/show_bug.cgi?id=23063 Issue ID: 23063 Summary: It is possible to return a noreturn value Product: D Version: D2 Hardware: x86_64 OS: All Status: NEW Severity: blocker Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: razvan.nitu1305 gmail.com noreturn func() { noreturn a; return a; } void main() { func(); } This code compiles and runs succefully, despite the dip [1] explicitly stating: "Defining a noreturn variable with no initialization expression generates an assert(0) only if the variable is accessed, which can be useful in generic code where unused noreturn variables may be declared. Generating the assert(0) as soon as the variable is live in these cases could prematurely end the program." This currently blocks: https://github.com/dlang/dmd/pull/12898 [1] https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1034.md --
Apr 27 2022