[Issue 22757] New: importC:Error: forward reference to (*pRowSet).pChunk

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 10 10:59:02 UTC 2022


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

          Issue ID: 22757
           Summary: importC:Error: forward reference to (*pRowSet).pChunk
           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: dave287091 at gmail.com

The following reduced C code from sqlite fails to compile:


typedef struct RowSet RowSet;
struct RowSetChunk {
    struct RowSetChunk *pNextChunk;
};
struct RowSet {
    struct RowSetChunk *pChunk;
};
void foo(struct RowSet *pRowSet){
    struct RowSetChunk **ppPrevTree = &pRowSet->pChunk; // Error: forward
reference to `(*pRowSet).pChunk`
}

Oddly, if you remove the typedef it compiles without error, even though the
typedef is not used at all. If you move the typedef, it also compiles without
error.

--


More information about the Digitalmars-d-bugs mailing list