[Issue 24277] New: ImportC: struct initializer entry gets ignored (pt2)
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Dec 11 14:45:13 UTC 2023
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 at puremagic.com
Reporter: dkorpel at 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, , )`
--
More information about the Digitalmars-d-bugs
mailing list