Skip to content

Commit

Permalink
Fix Issue 12866 - concatenating to std.container.array of static arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
David Marquant committed Jun 11, 2017
1 parent 3b83cfd commit 7c21752
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion std/container/array.d
Expand Up @@ -730,7 +730,7 @@ if (!is(Unqual!T == bool))
void opOpAssign(string op, Stuff)(Stuff stuff)
if (op == "~")
{
static if (is(typeof(stuff[])))
static if (is(typeof(stuff[])) && isImplicitlyConvertible!(typeof(stuff[0]), T))
{
insertBack(stuff[]);
}
Expand Down Expand Up @@ -2400,3 +2400,23 @@ if (is(Unqual!T == bool))
assert(a.length == 11, to!string(a.length));
assert(a[5]);
}
@system unittest
{
alias V3 = int[3];
V3 v = [1, 2, 3];
Array!V3 arr;
arr ~= v;
assert(arr[0] == [1, 2, 3]);

arr = arr ~ v;
assert(arr[1] == [1, 2, 3]);
}
@system unittest
{
alias V3 = int[3];
V3[2] v = [[1, 2, 3], [4, 5, 6]];
Array!V3 arr;
arr ~= v;
assert(arr[0] == [1, 2, 3]);
assert(arr[1] == [4, 5, 6]);
}

0 comments on commit 7c21752

Please sign in to comment.