Bug 8442 – [2.060 beta] Empty array enum not treated as immutable

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-07-25T14:31:00Z
Last change time
2015-06-09T05:11:58Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
bus_dbugzilla

Comments

Comment #0 by bus_dbugzilla — 2012-07-25T14:31:08Z
------------------------------------- enum int[] fooEnum = []; immutable fooImmutable = fooEnum; ------------------------------------- testImmutableEnum.d(2): Error: cannot implicitly convert expression ([]) of type int[] to immutable(int[]) ------------------------------------- Worked on 2.059. If fooEnum is *not* empty, the problem disappears.
Comment #1 by github-bugzilla — 2012-07-28T02:24:43Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/99ea168b02260bbb067a5ac7783df32dfe6fad66 fix Issue 8442 - [2.060 beta] Empty array enum not treated as immutable This is a regression of fixing issue 2006. If empty array literal has the type T[] and T isn't void, should check proper element type convertible (T[] to U --> T to U). https://github.com/D-Programming-Language/dmd/commit/c607144504055bb16eb366e90e2af9e34e8bdac9 Merge pull request #1065 from 9rnsr/fix8442 Issue 8442 - [2.060 beta] Empty array enum not treated as immutable
Comment #2 by k.hara.pg — 2012-07-28T03:35:33Z
Comment #3 by k.hara.pg — 2012-07-28T09:40:19Z
D1 has similar problem. const int[] fooEnum1 = [1]; const int[] fooEnum0 = []; void main() { const int[1] fooImmutable1 = fooEnum1; // OK const int[0] fooImmutable0 = fooEnum0; // Error // test.d(2): Error: cannot implicitly convert expression ([]) of type int[] to int[0u] }
Comment #4 by k.hara.pg — 2012-07-28T11:40:22Z