Bug 14737 – [REG2.058] A concatenation of array literal and static array should make dynamic array

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-06-26T04:51:00Z
Last change time
2017-07-22T12:35:41Z
Keywords
industry, pull, rejects-valid
Assigned to
nobody
Creator
briancschott

Comments

Comment #0 by briancschott — 2015-06-26T04:51:02Z
``` private struct S { int a; int b; int c; } void main() { import std.traits:FieldNameTuple; enum string[2] a = ["d", "e"]; enum b = [FieldNameTuple!S] ~ a; string[2] a2 = ["c", "d"]; auto b2 = [FieldNameTuple!S] ~ a2; } ``` With 2.067.1 this fails with the following error: test.d(16): Error: e2ir: cannot cast ["a", "b", "c"] of type string[] to type string[2] That's a bug, but at least the enum case was allowed to compile. With 2.068.0-b1, it fails with this error: test.d(12): Error: cannot cast expression ["a", "b", "c"] of type string[] to string[2] test.d(16): Error: cannot cast expression ["a", "b", "c"] of type string[] to string[2]
Comment #1 by briancschott — 2015-06-26T05:38:18Z
Digger has traced this back to DMD commit 0b3641ad960ba7f4d8d5f5a23fec52e506017bd6
Comment #2 by k.hara.pg — 2015-06-26T06:03:51Z
(In reply to briancschott from comment #0) > With 2.068.0-b1, it fails with this error: > test.d(12): Error: cannot cast expression ["a", "b", "c"] of type string[] > to string[2] > test.d(16): Error: cannot cast expression ["a", "b", "c"] of type string[] > to string[2] A concatenation T[] ~ T[n] should be typed as T[], so the both cases should succeed to compile. With the reduced test case: void main() { string[2] a2 = ["d", "e"]; auto b2 = ["a", "b", "c"] ~ a2; assert(b2 == ["a", "b", "c", "d", "e"]); } It had worked until 2.057, but since 2.058 e2ir error has occurred. The rejects-valid regression was introduced in: https://github.com/D-Programming-Language/dmd/pull/618
Comment #3 by k.hara.pg — 2015-06-26T12:48:04Z
Comment #4 by github-bugzilla — 2015-06-26T21:26:01Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/05101662d1d7ed8df51f391b993d3640496df51d fix Issue 14737 - A concatenation of array literal and static array should make dynamic array https://github.com/D-Programming-Language/dmd/commit/d8eb13976386dcf4eaaf3732e6f55eeeab545f02 Merge pull request #4776 from 9rnsr/fix14737 [REG2.058] Issue 14737 - A concatenation of array literal and static array should make dynamic array
Comment #5 by github-bugzilla — 2015-07-01T01:25:10Z
Commit pushed to stable at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/d68e8d61ccabd1ae7c2252b86cda56e13adef1c4 Merge pull request #4776 from 9rnsr/fix14737 [REG2.058] Issue 14737 - A concatenation of array literal and static array should make dynamic array
Comment #6 by github-bugzilla — 2015-07-24T03:20:14Z
Comment #7 by github-bugzilla — 2015-10-04T18:18:42Z
Commits pushed to stable at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/05101662d1d7ed8df51f391b993d3640496df51d fix Issue 14737 - A concatenation of array literal and static array should make dynamic array https://github.com/D-Programming-Language/dmd/commit/d8eb13976386dcf4eaaf3732e6f55eeeab545f02 Merge pull request #4776 from 9rnsr/fix14737
Comment #8 by github-bugzilla — 2017-07-22T12:35:41Z
Commits pushed to dmd-cxx at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/05101662d1d7ed8df51f391b993d3640496df51d fix Issue 14737 - A concatenation of array literal and static array should make dynamic array https://github.com/dlang/dmd/commit/d8eb13976386dcf4eaaf3732e6f55eeeab545f02 Merge pull request #4776 from 9rnsr/fix14737