Bug 8041 – __gshared/static problem

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-05-04T15:09:00Z
Last change time
2013-03-27T05:16:23Z
Keywords
pull, rejects-valid
Assigned to
andrej.mitrovich
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2012-05-04T15:09:57Z
I am not sure, I think this is valid code: struct Foo { __gshared static int x; } void main() { __gshared Foo f; // line 5 } But DMD 2.060alpha gives the error: test.d(5): Error: non-constant expression f = 0
Comment #1 by andrej.mitrovich — 2012-12-26T16:42:37Z
Reduced: struct Foo {} void main() { __gshared Foo f; } Very odd bug. Works with static.
Comment #2 by andrej.mitrovich — 2012-12-27T13:33:25Z
Comment #3 by github-bugzilla — 2013-03-18T02:17:40Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/c55c6199ec81b4b5bbb0942d861d162301ca22b1 Fixes Issue 8041 - __gshared without initializer fails compilation. https://github.com/D-Programming-Language/dmd/commit/245e3673a6a71d85007a6a804591a816e0d84379 Merge pull request #1414 from AndrejMitrovic/Fix8041 Issue 8041 - __gshared without initializer fails compilation