Bug 23063 – It is possible to return a noreturn value

Status
RESOLVED
Resolution
FIXED
Severity
blocker
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
All
Creation time
2022-04-27T10:29:13Z
Last change time
2022-06-09T13:57:04Z
Keywords
pull
Assigned to
No Owner
Creator
RazvanN

Comments

Comment #0 by razvan.nitu1305 — 2022-04-27T10:29:13Z
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
Comment #1 by dlang-bot — 2022-06-06T13:53:24Z
@RazvanN7 created dlang/dmd pull request #14187 "Fix Issue 23063 - It is possible to return a noreturn value" fixing this issue: - Fix Issue 23063 - It is possible to return a noreturn value https://github.com/dlang/dmd/pull/14187
Comment #2 by dlang-bot — 2022-06-09T13:57:04Z
dlang/dmd pull request #14187 "Fix Issue 23063 - It is possible to return a noreturn value" was merged into master: - 8a0812895ccfabcdee31f2140c203367ccee5e97 by RazvanN7: Fix Issue 23063 - It is possible to return a noreturn value https://github.com/dlang/dmd/pull/14187