diff --git a/src/convert.jl b/src/convert.jl index f1b6ef5e..07f2d109 100644 --- a/src/convert.jl +++ b/src/convert.jl @@ -26,7 +26,8 @@ end return _convert(SA, a, Length(SA)) end -@inline _convert(SA, a, ::Length{L}) where L = SA(unroll_tuple(a, Length(SA))) +@inline _convert(SA, a, l::Length) = SA(unroll_tuple(a, l)) +@inline _convert(SA::Type{<:StaticArray{<:Tuple,T}}, a, ::Length{0}) where T = similar_type(SA, T)(()) @inline _convert(SA, a, ::Length{0}) = similar_type(SA, eltype(a))(()) length_val(a::T) where {T <: StaticArrayLike} = length_val(Size(T)) diff --git a/test/convert.jl b/test/convert.jl index 6d1f8d8b..00319a18 100644 --- a/test/convert.jl +++ b/test/convert.jl @@ -10,4 +10,8 @@ end # testset # Issue #520 @testinf SVector{0}(Int8[]) === SVector{0,Int8}() @testinf SMatrix{0,0}(zeros(0,0)) === SMatrix{0,0,Float64}(()) + + # Issue #651 + @testinf SVector{0,Float64}(Any[]) === SVector{0,Float64}() + @testinf SVector{0,Float64}(Int8[]) === SVector{0,Float64}() end