Bug 24274 – [REG master] ImportC: unrecognized C initializer with array in struct
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2023-12-08T09:44:04Z
Last change time
2023-12-11T14:46:39Z
Keywords
ImportC, pull, rejects-valid
Assigned to
No Owner
Creator
Dennis
Comments
Comment #0 by dkorpel — 2023-12-08T09:44:04Z
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}}`
Comment #1 by dlang-bot — 2023-12-11T08:29:55Z
@WalterBright created dlang/dmd pull request #15898 "fix Issue 24274 - [REG master] ImportC: unrecognized C initializer wi…" fixing this issue:
- fix Issue 24274 - [REG master] ImportC: unrecognized C initializer with array in struct
https://github.com/dlang/dmd/pull/15898
Comment #2 by dlang-bot — 2023-12-11T14:46:39Z
dlang/dmd pull request #15898 "fix Issue 24274 - [REG master] ImportC: unrecognized C initializer wi…" was merged into master:
- 8141f66dcef8782909cb207c3fa73bfc9ee82e14 by Walter Bright:
fix Issue 24274 - [REG master] ImportC: unrecognized C initializer with array in struct
https://github.com/dlang/dmd/pull/15898