Bug 11105 – Error on struct with multidimentional static array initialization from its element

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-09-22T23:12:00Z
Last change time
2013-10-03T13:58:30Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
verylonglogin.reg

Comments

Comment #0 by verylonglogin.reg — 2013-09-22T23:12:17Z
This used to compile: --- struct S { int[2][1] a21; } void main() { S s = S([1, 2]); // Error: cannot implicitly convert expression ([1, 2]) of type int[] to int[2u][1u] } --- Not sure about validity of the issue as documentation doesn't provide exact implicit conversions on struct initialization.
Comment #1 by clugdbug — 2013-09-23T03:38:45Z
> Not sure about validity of the issue as documentation doesn't provide exact implicit conversions on struct initialization. I'm not sure either. struct S { int [2][1] xx = [1, 2]; } prints: test.d(3): Error: array initializer has 2 elements, but array length is 1. So the struct literal behaviour is consistent with that. Yet, void main() { int [2][1] xx = [1, 2]; } is accepted. I think the difference in behaviour is hard to justify.
Comment #2 by k.hara.pg — 2013-10-01T21:07:01Z
Comment #3 by github-bugzilla — 2013-10-03T13:58:14Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/d4638f1f70c602987f1e0cab62818d399b64a219 fix Issue 11105 - Error on struct with multidimentional static array initialization from its element https://github.com/D-Programming-Language/dmd/commit/efcd62c6d5c1ac1b59cba6c5eb546803c2c5931f Merge pull request #2611 from 9rnsr/fix11105 [REG2.064a] Issue 11105 - Error on struct with multidimentional static array initialization from its element