www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22929] New: importC: extern array with unknown length gives

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

          Issue ID: 22929
           Summary: importC: extern array with unknown length gives bounds
                    errors
           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

two cases:

// 1
extern int xs[];
void fn() { void *xp = &(xs[0]); }

// 2
struct S { char text[4]; };
extern struct S ops[];
char *args[] = { ops[0].text };

Error: array index 0 is out of bounds `[0..0]`

--
Mar 25 2022