www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24277] New: ImportC: struct initializer entry gets ignored

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

          Issue ID: 24277
           Summary: ImportC: struct initializer entry gets ignored (pt2)
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ImportC
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dkorpel live.nl

```C
struct S5
{
    int s;
    struct
    {
        int vis;
        int count;
        int id;
        struct
        {
            int symbol;
            int state;
        } leaf;
    };
};

struct S5 s5 = (struct S5) {
    .s = 10,
    {
        .count = 20,
        .id = 30,
        .leaf = {.symbol = 40, .state = 50},
    }
};

int main()
{
    __check(s5.id == 30);
    __check(s5.leaf.symbol == 40);
    __check(s5.leaf.state == 50);
    return 0;
}
```

The asserts all fail, and -vcg-ast shows the initializer gets translated to
`S5(10, , 20, , )`

--
Dec 11 2023