Bug 19735 – Error: variable extern symbols cannot have initializers

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-03-13T10:46:59Z
Last change time
2019-03-15T11:52:42Z
Keywords
pull
Assigned to
No Owner
Creator
Iain Buclaw

Comments

Comment #0 by ibuclaw — 2019-03-13T10:46:59Z
Similar to issue 19734, but emphasis on the effect on user code, not the blatant implementation bug. Given the following example: extern { int f1(int a) { return a + 2; } int f2(int a) { int b = 42; return a + b; } } You get the error during compilation of f2: Error: variable `b` extern symbols cannot have initializers As has already been established in 19734, even the parameter `a` is considered an extern symbol. However, the function `f1` compiles and a body is emitted without complaint. Either `f1` should also be considered an error, or `f2` should be fixed to become valid code.
Comment #1 by dlang-bot — 2019-03-13T20:57:54Z
@ibuclaw updated dlang/dmd pull request #9451 "fix Issue 19734 - isDataseg returns true for non-static declarations" fixing this issue: - fix Issue 19735 - Error: variable extern symbols cannot have initializers https://github.com/dlang/dmd/pull/9451
Comment #2 by dlang-bot — 2019-03-14T08:02:22Z
dlang/dmd pull request #9451 "fix Issue 19734 - isDataseg returns true for non-static declarations" was merged into master: - 792742d285a8bb5e23877ef3f7e50b69ad044dbf by Iain Buclaw: fix Issue 19735 - Error: variable extern symbols cannot have initializers https://github.com/dlang/dmd/pull/9451
Comment #3 by dlang-bot — 2019-03-15T11:52:42Z
dlang/dmd pull request #9452 "[dmd-cxx] fix Issue 19734 and 19735" was merged into dmd-cxx: - d3062116f822d8e3d450f7bc50038b6e4a4b5c8d by Iain Buclaw: fix Issue 19735 - Error: variable extern symbols cannot have initializers https://github.com/dlang/dmd/pull/9452