www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22104] New: importC: Parser accepts arrays with incomplete

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

          Issue ID: 22104
           Summary: importC: Parser accepts arrays with incomplete element
                    types
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ibuclaw gdcproject.org

This is wrong code in C, but dmd CParser accepts it as valid.
---
int array1[][4];  // NG: Requires explicit initializer

int array2[4][];  // NG: Incomplete element type.
                  //     Multidimensional array must have bounds for all
                  //     dimensions except the first.

int testfn(int p[4][]); // NG: Incomplete element type.
                        // Proper way to "complete" type is to use `[*]`
---

--
Jul 05 2021