www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24114] New: no crash on use of a noreturn enum member

https://issues.dlang.org/show_bug.cgi?id=24114

          Issue ID: 24114
           Summary: no crash on use of a noreturn enum member
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: b2.temp gmx.com

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) {}
}
```

--
Aug 27 2023