Bug 22705 – importC: forward reference to struct typedef gives struct already exists

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-01-25T14:08:45Z
Last change time
2022-01-28T14:12:24Z
Keywords
ImportC, pull
Assigned to
No Owner
Creator
duser

Comments

Comment #0 by duser — 2022-01-25T14:08:45Z
``` data_t *p; struct data_s { int x; }; typedef struct data_s data_t; ``` test.c(2): Error: struct `test.data_s` already exists at test.c(5). Perhaps in another function with the same name? this used to work before the fix for issue 22623
Comment #1 by duser — 2022-01-25T15:01:03Z
slightly different example: ``` struct data1_s; struct data2_s { int x; }; typedef struct data2_s data2_t; struct data1_s { data2_t* p; }; ``` test.c(3): Error: struct `test.data2_s` already exists at test.c(6). Perhaps in another function with the same name? the error disappears if the forward declaration of struct data1_s is removed
Comment #2 by dlang-bot — 2022-01-28T07:55:22Z
@WalterBright created dlang/dmd pull request #13576 "fix Issue 22705 - ImportC: forward reference to struct typedef gives …" fixing this issue: - fix Issue 22705 - importC: forward reference to struct typedef gives struct already exists https://github.com/dlang/dmd/pull/13576
Comment #3 by dlang-bot — 2022-01-28T14:12:24Z
dlang/dmd pull request #13576 "fix Issue 22705 - ImportC: forward reference to struct typedef gives …" was merged into master: - c848d7e92749d1940708e70da4a1733a78339e54 by Walter Bright: fix Issue 22705 - importC: forward reference to struct typedef gives struct already exists https://github.com/dlang/dmd/pull/13576