I was able to add 4 lines to compiler/src/dmd/hdrgen.d to fix the problem. But I don't know if that fix is complete or has bad side-effects. (never worked with dmd code base before)
text/plain
639
Comments
Comment #0 by michaelate — 2024-07-21T13:25:39Z
Created attachment 1915
I was able to add 4 lines to compiler/src/dmd/hdrgen.d to fix the problem. But I don't know if that fix is complete or has bad side-effects. (never worked with dmd code base before)
C-code:
struct S
{
int x;
};
const struct S fun(int y);
.di file:
//...
const S fun(int y);
//...
The above code doesn't compile. It should be instead:
//...
const (S) fun(int y);
//...
Comment #1 by dlang-bot — 2024-07-21T14:53:29Z
@dkorpel created dlang/dmd pull request #16741 "Fix bugzilla 24670 - importC: .di generation does not place parenthes…" fixing this issue:
- Fix bugzilla 24670 - importC: .di generation does not place parentheses around const struct return types
https://github.com/dlang/dmd/pull/16741
Comment #2 by dlang-bot — 2024-07-21T22:44:07Z
dlang/dmd pull request #16741 "Fix bugzilla 24670 - importC: .di generation does not place parenthes…" was merged into master:
- 0b83ddae8f42eac2c7e761af43315c7b27fce9ee by Dennis Korpel:
Fix bugzilla 24670 - importC: .di generation does not place parentheses around const struct return types
https://github.com/dlang/dmd/pull/16741