https://issues.dlang.org/show_bug.cgi?id=23388
Issue ID: 23388
Summary: ImportC: redeclaration of struct in different
translation unit doesn’t check compatibility
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: accepts-invalid, ImportC
Severity: normal
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
// 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).
--