www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23533] New: Segmentation fault accessing enum.max with

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

          Issue ID: 23533
           Summary: Segmentation fault accessing enum.max with
                    -preview=nosharedaccess
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: andy.pj.hanson gmail.com

To reproduce, just access `E.max` at least once, and an enum member other than
the first at least once.
The issue doesn't reproduce if the enum has only one member.

```
enum E { a, b }

void main() {
        E x = E.b;
        E y = E.max;
}
```

`dmd -preview=nosharedaccess a.d` causes a segmentation fault. 
`dmd a.d` has no problem.

Tested with dmd v2.101.0.

--
Dec 01 2022