Bug 23030 – importC: errors using typedef struct after first use as const

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-04-17T13:12:32Z
Last change time
2022-09-06T06:40:09Z
Keywords
ImportC, pull, rejects-valid
Assigned to
No Owner
Creator
duser
See also
https://issues.dlang.org/show_bug.cgi?id=23034

Comments

Comment #0 by duser — 2022-04-17T13:12:32Z
// test1.c typedef struct { int i; } S1; const S1 unused; S1 s; void fn() { int i = s.i; } // Error: need `this` for `i` of type `int` // test2.c typedef struct { int a,b; } S2; const S2 aaa = { 0,0 }; S2 bbb = { 0,0 }; // Error: 1 extra initializer(s) for `struct __tag3` both bisected to https://github.com/dlang/dmd/pull/13990
Comment #1 by bugzilla — 2022-04-20T04:55:52Z
Comment #2 by bugzilla — 2022-04-20T05:29:13Z
oh well, it isn't.
Comment #3 by duser — 2022-05-05T11:14:35Z
increasing the importance since this would become a regression in v2.100.0 compared to v2.099.1 if there's no immediate fix available, then i'd prefer if the PR that caused this was reverted since the bug(s) it fixes weren't that common compared to this one
Comment #4 by dlang-bot — 2022-09-04T06:33:34Z
@WalterBright created dlang/dmd pull request #14409 "fix Issue 23030 - importC: errors using typedef struct after first us…" fixing this issue: - fix Issue 23030 - importC: errors using typedef struct after first use as const https://github.com/dlang/dmd/pull/14409