Bug 13215 – Error message with static this array assignment

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2014-07-27T14:01:41Z
Last change time
2020-08-23T15:19:32Z
Keywords
diagnostic, pull
Assigned to
No Owner
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2014-07-27T14:01:41Z
import std.algorithm: map; import std.array: array; enum uint N = 10; immutable uint[2][3] arr1 = [1, 2, 3].map!(x => [x, x]).array; // OK. immutable uint[2][3] arr2; static this() { arr2 = [1, 2, 3].map!(x => [x, x]).array; } void main() {} dmd 2.066beta5 gives: test.d(7,39): Error: cannot implicitly convert expression (array(map([1, 2, 3]))) of type int[][] to immutable(uint)[] But I expect that code to work, or to give an error message like: test.d(7,39): Error: cannot implicitly convert expression (array(map([1, 2, 3]))) of type int[][] to immutable(uint)[2][]
Comment #1 by per.nordlow — 2020-08-23T09:32:14Z
This has already been resolved on dmd master.
Comment #2 by dlang-bot — 2020-08-23T11:12:03Z
@nordlow created dlang/dmd pull request #11609 "fix issue 13215" fixing this issue: - fix issue 13215 https://github.com/dlang/dmd/pull/11609
Comment #3 by dlang-bot — 2020-08-23T15:19:32Z
dlang/dmd pull request #11609 "fix issue 13215: Add test for already improved diagnostics for array conversion" was merged into master: - 3ed3b26ad8508398cf7d3c856181f39c356dddf0 by nordlow: fix issue 13215: Add test for already improved diagnostics for array conversion https://github.com/dlang/dmd/pull/11609