January 08, 2024
https://issues.dlang.org/show_bug.cgi?id=24326

          Issue ID: 24326
           Summary: ImportC: segfault on nameless enum translation with -H
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ImportC
          Severity: normal
          Priority: P3
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: dkorpel@live.nl

>From the news group:
https://forum.dlang.org/post/aeckmmetwqmgicsubcem@forum.dlang.org

Reduced:
```
enum { A };
```

Compile with `-H` and you get a segfault.

The responsible code is in hdrgen.d:
```
        foreach (em; *d.members)
        {
            if (!em)
                continue;
            buf.writestring("alias ");
            buf.writestring(em.ident.toString);
            buf.writestring(" = ");
            buf.writestring(d.ident.toString);
            buf.writeByte('.');
            buf.writestring(em.ident.toString);
            buf.writeByte(';');
            buf.writenl();
        }
```

This assumes enums have a name, but in this case, d.ident is null.

--