[Issue 23030] New: importC: errors using typedef struct after first use as const

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Apr 17 13:12:32 UTC 2022


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

          Issue ID: 23030
           Summary: importC: errors using typedef struct after first use
                    as const
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ImportC, rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: duser at neet.fi
                CC: duser at neet.fi

// test1.c
typedef struct {
    int i;
} S1;
const S1 unused;
S1 s;
void fn() { int i = s.i; } // Error: need `this` for `i` of type `int`

// test2.c
typedef struct {
    int a,b;
} S2;
const S2 aaa = { 0,0 };
S2 bbb = { 0,0 }; // Error: 1 extra initializer(s) for `struct __tag3`

both bisected to https://github.com/dlang/dmd/pull/13990

--


More information about the Digitalmars-d-bugs mailing list