Bug 22104 – importC: Parser accepts arrays with incomplete element types
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-07-06T00:09:14Z
Last change time
2021-10-13T13:17:30Z
Keywords
ImportC, pull
Assigned to
No Owner
Creator
Iain Buclaw
Comments
Comment #0 by ibuclaw — 2021-07-06T00:09:14Z
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 `[*]`
---
Comment #1 by bugzilla — 2021-09-01T09:03:30Z
It's a semantic error, not a parsing error. Can't be done by the parser because of typedef's.
Comment #2 by bugzilla — 2021-10-10T06:29:26Z
The second and third tests currently and correctly produce an error message.
Comment #3 by dlang-bot — 2021-10-10T06:37:57Z
@WalterBright created dlang/dmd pull request #13146 "fix Issue 22104 - importC: Parser accepts arrays with incomplete elem…" fixing this issue:
- fix Issue 22104 - importC: Parser accepts arrays with incomplete element types
https://github.com/dlang/dmd/pull/13146
Comment #4 by dlang-bot — 2021-10-10T12:49:44Z
dlang/dmd pull request #13146 "fix Issue 22104 - importC: Parser accepts arrays with incomplete elem…" was merged into stable:
- 31ffc2e823caee048f3f70f2b822539fe4f843fb by Walter Bright:
fix Issue 22104 - importC: Parser accepts arrays with incomplete element types
https://github.com/dlang/dmd/pull/13146
Comment #5 by dlang-bot — 2021-10-13T13:17:30Z
dlang/dmd pull request #13164 "Merge stable" was merged into master:
- 57cd571c015191865df97419eccf6c8074ef13ef by Walter Bright:
fix Issue 22104 - importC: Parser accepts arrays with incomplete element types
https://github.com/dlang/dmd/pull/13164