[Issue 24274] New: [REG master] ImportC: unrecognized C initializer with array in struct

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Dec 8 09:44:04 UTC 2023


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

          Issue ID: 24274
           Summary: [REG master] ImportC: unrecognized C initializer with
                    array in struct
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ImportC, rejects-valid
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: dkorpel at live.nl

Introduced by https://github.com/dlang/dmd/pull/15891

```C
struct S0
{
    struct
    {
        char short_data[24];
    };
    int length;
};

struct S0 s0 = {{.short_data = {0}}, .length = 0};
```

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


```C
struct S1
{
    struct
    {
        char* long_data;
        char short_data[24];
    };
    int length;
};

struct S1 s1 = {{.short_data = {0}}, .length = 0};
```

Error: unrecognized C initializer `{.short_data={0}}`

--


More information about the Digitalmars-d-bugs mailing list