www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23034] New: importC: head-const struct confused with multiple

https://issues.dlang.org/show_bug.cgi?id=23034

          Issue ID: 23034
           Summary: importC: head-const struct confused with multiple
                    files on command line
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ImportC, rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: duser neet.fi
                CC: duser neet.fi

// file1.c
struct S1 {
        int field1;
};
struct S1 *const unused;

// file2.c
struct S2 {
        int field2;
};
void fn()
{
        struct S2 *const s;
        int x = s->field2; // here
}

compile: dmd file1.c file2.c

file2.c(7): Error: `field2` is not a member of `const(S1)`

similar to issue 23030 but not caused by the same PR (this exists on stable
v2.099.1 too)

--
Apr 17 2022