diff --git a/base/abstractarray.jl b/base/abstractarray.jl index a2ce7b4f95c9b..be546320e833d 100644 --- a/base/abstractarray.jl +++ b/base/abstractarray.jl @@ -2582,7 +2582,7 @@ function _vstack_plus(itr) len = length(val) n = haslength(itr) ? len*length(itr) : nothing - v = similar(val isa Tuple ? (1:0) : val, something(n, len)) + v = similar(val isa Tuple ? (1:0) : val, eltype(val), something(n, len)) copyto!(v, 1, val, firstindex(val), len) w = _stack_rest!(v, 0, n, axe, itr, state) diff --git a/test/abstractarray.jl b/test/abstractarray.jl index ecffe0f9d7312..5409253b258b8 100644 --- a/test/abstractarray.jl +++ b/test/abstractarray.jl @@ -1575,6 +1575,7 @@ end @test stack([(1,2), (3,4)]) == [1 3; 2 4] @test stack(((1,2), (3,4))) == [1 3; 2 4] @test size(stack(Iterators.product(1:3, 1:4))) == (2,3,4) + @test stack([('a', 'b'), ('c', 'd')]) == ['a' 'c'; 'b' 'd'] # Mismatched sizes @test_throws DimensionMismatch stack([1:2, 1:3])