Bug 22321 – ImportC: non-static arrays can’t be initialized by an initializer list.
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-09-19T16:08:46Z
Last change time
2021-10-08T07:02:44Z
Keywords
ImportC, pull, rejects-valid
Assigned to
No Owner
Creator
dave287091
Comments
Comment #0 by dave287091 — 2021-09-19T16:08:46Z
Demonstration of the problem:
int gnumbers[4] = {1,2,3,4}; // ok
int example(void){
int numbers[4] = {1, 2, 3, 4}; // Error: variable `test.example.numbers` is not a static and cannot have static initializer
return numbers[1];
}
Comment #1 by bugzilla — 2021-09-27T07:19:00Z
To fix this properly requires the initializerSemantic() function to properly convert a C initializer to a D initializer.
Comment #2 by dlang-bot — 2021-09-27T08:19:25Z
@WalterBright created dlang/dmd pull request #13101 "fix Issue 22321 - ImportC: non-static arrays can.t be initialized by …" fixing this issue:
- fix Issue 22321 - ImportC: non-static arrays can.t be initialized by an initializer list
https://github.com/dlang/dmd/pull/13101
Comment #3 by dlang-bot — 2021-09-29T20:15:20Z
dlang/dmd pull request #13101 "fix Issue 22321 - ImportC: non-static arrays can.t be initialized by …" was merged into stable:
- 64fdefb0cc9ba288aeecc7c7f3929d76d3e9aade by Walter Bright:
fix Issue 22321 - ImportC: non-static arrays can.t be initialized by an initializer list
https://github.com/dlang/dmd/pull/13101
Comment #4 by dlang-bot — 2021-10-08T07:02:44Z
dlang/dmd pull request #13140 "merge stable" was merged into master:
- 94645f7c9897569bc37410de0a8932c37bd7bd51 by Walter Bright:
fix Issue 22321 - ImportC: non-static arrays can.t be initialized by an initializer list (#13101)
https://github.com/dlang/dmd/pull/13140