Hello D community,
The past week, I worked on fixing compilation failures in importC involving struct delegated initializer.
struct Foo {
int x;
int y;
};
struct Bar {
struct Foo f;
};
struct Bar b = {.f.x = 3}; // Error: only 1 designator currently allowed for C struct field initializer
struct Bar b2 = {
.f.x = 3, // Error: only 1 designator currently allowed for C struct field initializer
.f.y = 4,
};
Issue report: https://issues.dlang.org/show_bug.cgi?id=23374
I researched into this issue and implemented a fix to it and has been successfully merged.
Link to PR: https://github.com/dlang/dmd/pull/21883#event-19812674196
Now, that importC code compiles fine and also has been tested.
Additionally, I came across some inconsistencies in the dlang spec on importC enum. it strictly indicated that enum expressions are typed as 'int'. and some of the examples in the language spec was not also correct. I submitted a fix to it which has also been merged.
PR: https://github.com/dlang/dlang.org/pull/4317#event-19832789696
In the next week, I will be working on fixing issues involving taking the address of compound literals.