[Issue 23913] New: __traits(getMember) fails for some C symbols

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 12 08:11:48 UTC 2023


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

          Issue ID: 23913
           Summary: __traits(getMember) fails for some C symbols
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: betterC
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: andrej.mitrovich at gmail.com

This works in v2.102.0 but fails in v2.013.x:

library.c:

```
typedef enum SomeEnum
{
    foo = 0,
    bar = -10000,
} SomeEnum;
```

mod.d:

```
module mod;

import library;

alias x = __traits(getMember, library, "SomeEnum");
```

```
$ dmd -c library.c mod.d
[1]    28653 illegal hardware instruction (core dumped)  dmd -c library.c mod.d
core.exception.AssertError at src/dmd/expressionsem.d(13055): Assertion failure
```

Specifically:
https://github.com/dlang/dmd/blob/a45f4e9f43e9fdbf0b666175e5e66b1ce4f561f6/compiler/src/dmd/expressionsem.d#L13054

It seems to only fail for typedef'ed enums like this.

--


More information about the Digitalmars-d-bugs mailing list