Bug 23388 – ImportC: redeclaration of struct in different translation unit doesn’t check compatibility

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-10-05T15:17:06Z
Last change time
2024-12-13T19:24:53Z
Keywords
accepts-invalid, ImportC
Assigned to
No Owner
Creator
dave287091
See also
https://issues.dlang.org/show_bug.cgi?id=23357
Moved to GitHub: dmd#18127 →

Comments

Comment #0 by dave287091 — 2022-10-05T15:17:06Z
// a.c struct Foo { int x; }; // b.c struct Foo { int x, y; }; //d.d import a; import b; static assert(a.Foo.sizeof != b.Foo.sizeof); // Fails The two structs are assumed to be the same type, size etc. and merged into one instead of iterating over their fields and ensuring all match (in other words, checking for compatibility before assuming they are the same).
Comment #1 by bugzilla — 2023-12-28T04:37:22Z
My excuse is C doesn't check it, either!
Comment #2 by robert.schadek — 2024-12-13T19:24:53Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18127 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB