-
Notifications
You must be signed in to change notification settings - Fork 152
Closed
Description
I have the following code which has worked fine until 1.4.4 and started to produce a StackOverflowError in 1.4.5. I have not done a bisect yet but I guess it's coming from #1026
This is the code, which ought to prevent a construction of the FieldVector subtype with different types:
struct Position{T} <: FieldVector{3, T}
x::T
y::T
z::T
Position(x::T, y::T, z::T) where {T} = new{T}(x, y, z)
endThe offending line is the inner constructor. It works with individual errors but gives a StackOverflowError when e.g. a tuple is passed:
julia> Position(1,2,3)
3-element Position{Int64} with indices SOneTo(3):
1
2
3
julia> Position((1,2,3))
ERROR: StackOverflowError:
Stacktrace:
[1] Position{Int64}(::Int64, ::Vararg{Int64})
@ StaticArrays ~/.julia/packages/StaticArrays/G7IlJ/src/convert.jl:152
[2] Position{Int64}(x::Tuple{Int64, Int64, Int64})
@ StaticArrays ~/.julia/packages/StaticArrays/G7IlJ/src/FieldArray.jl:113
--- the last 2 lines are repeated 18647 more times ---
[37297] StaticArray
@ ~/.julia/packages/StaticArrays/G7IlJ/src/convert.jl:152 [inlined]
If I remove that line, it works but then segfaults on v1.4.4 and below 😉 see here:
julia> Position(1,2,3.0)
ERROR: StackOverflowError:
Stacktrace:
[1] Position(::Int64, ::Vararg{Any})
@ StaticArrays ~/.julia/packages/StaticArrays/58yy1/src/convert.jl:4
[2] Position(x::Tuple{Int64, Int64, Float64})
@ StaticArrays ~/.julia/packages/StaticArrays/58yy1/src/FieldArray.jl:117--- the last 2 lines are repeated 18646 more times ---I guess the solution is to tag a version and limit the StaticArrays version to max 1.4.4 and then create a new one with the removed inner constructor and require at least 1.4.5. Or is there a better way?
Metadata
Metadata
Assignees
Labels
No labels