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

          Issue ID: 24031
           Summary: ImportC: DMD Rejects valid nested C initializers
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ImportC
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nob...@puremagic.com
          Reporter: dkor...@live.nl

>From the discussion in https://github.com/dlang/dmd/pull/15375

```C
typedef struct {
    struct {
        char data[24];
    };
    int length;
} ES;

ES empty = {{.data = {0}}, .length = 0};
```

```
Error: `[ constant-expression ]` expected for C array element initializer
`{.short_data={0}}`
```

```C
typedef struct {
    int k;
    struct {
        struct {
            struct {
                int s;
            } f;
        };
    };
} SH;

SH data = (SH) {
    .k = 0,
    {{.f = {.s = 0}}}
};
```

```
Error: unrecognized C initializer `{.f={.s=0}}`
```

--

Reply via email to