Bug 24447 – ImportC: extern symbols cannot have initializers

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2024-03-21T22:32:16Z
Last change time
2024-07-21T22:45:21Z
Keywords
ImportC, pull, rejects-valid
Assigned to
No Owner
Creator
dave287091

Comments

Comment #0 by dave287091 — 2024-03-21T22:32:16Z
The following C code is rejected: ``` extern int x = 3; ``` Error: variable `a.x` extern symbols cannot have initializers As far as I can tell this is legal C, if unidiomatic.
Comment #1 by dave287091 — 2024-03-21T22:39:01Z
`extern int x = 3;` at file scope should be treated the same as `int x = 3;`. Section 6.9.2 defines the rules and has an example.
Comment #2 by dlang-bot — 2024-07-21T15:17:49Z
@dkorpel created dlang/dmd pull request #16743 "Fix bugzilla 24447 - ImportC: extern symbols cannot have initializers" fixing this issue: - Fix bugzilla 24447 - ImportC: extern symbols cannot have initializers https://github.com/dlang/dmd/pull/16743
Comment #3 by dlang-bot — 2024-07-21T22:45:21Z
dlang/dmd pull request #16743 "Fix bugzilla 24447 - ImportC: extern symbols cannot have initializers" was merged into master: - e650e27b2b8a31aeba6875a8ca7497ddfdd83407 by Dennis Korpel: Fix bugzilla 24447 - ImportC: extern symbols cannot have initializers https://github.com/dlang/dmd/pull/16743