www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22757] New: importC:Error: forward reference to


          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 puremagic.com
          Reporter: dave287091 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

Feb 10 2022