D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 23027 - ImportC: Array of struct is not a static and cannot have static initializer
Summary: ImportC: Array of struct is not a static and cannot have static initializer
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords: ImportC, rejects-valid
Depends on:
Blocks:
 
Reported: 2022-04-17 06:28 UTC by dave287091
Modified: 2022-09-16 08:48 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description dave287091 2022-04-17 06:28:32 UTC
The following C code fails to compile:

struct S {
    int x;
};

int main(){
    struct S s[8] = {0}; // Error: variable `test.main.s` is not a static and cannot have static initializer
    return 0;
}
Comment 1 Dlang Bot 2022-09-16 08:48:22 UTC
dlang/dmd pull request #14443 "fix Issue 23027 - ImportC: Array of struct is not a static and cannot…" was merged into master:

- bb9d1f831b7e2ebdd74881303082b770b74d0f10 by Walter Bright:
  fix Issue 23027 - ImportC: Array of struct is not a static and cannot have static initializer

https://github.com/dlang/dmd/pull/14443