Bug 24114 – no crash on use of a noreturn enum member

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2023-08-27T07:42:54Z
Last change time
2023-08-30T11:40:00Z
Keywords
wrong-code
Assigned to
No Owner
Creator
Basile-z
See also
https://issues.dlang.org/show_bug.cgi?id=24115

Comments

Comment #0 by b2.temp — 2023-08-27T07:42:54Z
For the following code there's no runtime crash ``` enum E {e1 = 1, e2 = 2, illegal = noreturn} void main() { E e; // that assignment should have the same effect as assert(0) e = E.illegal; // just to be sure if (e) {} } ```
Comment #1 by nick — 2023-08-30T11:40:00Z
Note - the enum declaration is rejected by the fix for issue #24117.