Bug 22062 – importC: Error: redeclaration of 'TYPE'

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-06-21T18:05:09Z
Last change time
2021-06-27T14:09:23Z
Keywords
ImportC, pull, rejects-valid
Assigned to
No Owner
Creator
Iain Buclaw

Comments

Comment #0 by ibuclaw — 2021-06-21T18:05:09Z
Reduced test: --- typedef struct TYPE TYPE; This is valid C, e.g: --- typedef union tree **tree; int main() { union tree *a = 0; tree b = 0; // typed as union tree** return 0; }
Comment #1 by dlang-bot — 2021-06-22T07:52:06Z
@ibuclaw created dlang/dmd pull request #12727 "fix Issue 22062 - importC: Error: redeclaration of 'TYPE'" fixing this issue: - fix Issue 22062 - importC: Error: redeclaration of 'TYPE' https://github.com/dlang/dmd/pull/12727
Comment #2 by ibuclaw — 2021-06-22T10:08:14Z
This is also similar to issue 22061, but swapping the order or declarations. --- typedef union pthread_attr_t pthread_attr_t; union pthread_attr_t { char __size[56]; long int __align; };
Comment #3 by bugzilla — 2021-06-27T10:26:23Z
This works now, with the exception that C allows 0 to be implicitly converted to a pointer type, and (void*)0 to be implicitly converted to any pointer type.
Comment #4 by ibuclaw — 2021-06-27T14:09:02Z
Yep, fixed by https://github.com/dlang/dmd/pull/12755 (and issue 22086 made it compilable).
Comment #5 by ibuclaw — 2021-06-27T14:09:23Z
Dealing with type semantic can be moved to another issue.