diff --git a/base/promotion.jl b/base/promotion.jl index af38a41118235..1ca5530a7b828 100644 --- a/base/promotion.jl +++ b/base/promotion.jl @@ -206,6 +206,7 @@ minmax(x::Real, y::Real) = minmax(promote(x, y)...) # promote_op{R<:MyType,S<:MyType}(::typeof(*), ::Type{R}, ::Type{S}) = MyType{multype(R,S)} promote_op(::Any) = (@_pure_meta; Bottom) promote_op(::Any, T) = (@_pure_meta; T) +promote_op{T}(::Type{T}, ::Any) = (@_pure_meta; T) promote_op{R,S}(::Any, ::Type{R}, ::Type{S}) = (@_pure_meta; promote_type(R, S)) promote_op(op, T, S, U, V...) = (@_pure_meta; promote_op(op, T, promote_op(op, S, U, V...))) diff --git a/test/broadcast.jl b/test/broadcast.jl index a3904ecc9a399..4bf1260b759e5 100644 --- a/test/broadcast.jl +++ b/test/broadcast.jl @@ -127,3 +127,8 @@ end let a = Real[2, 2.0, 4//2] / 2.0 @test eltype(a) == Real end + +# issue 16164 +let a = broadcast(Float32, [3, 4, 5]) + @test eltype(a) == Float32 +end