Skip to content

Stack overflow from loop in FieldVector constructor with mismatched types #375

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
zsunberg opened this issue Mar 4, 2018 · 0 comments
Labels

Comments

@zsunberg
Copy link

zsunberg commented Mar 4, 2018

struct Point{R<:Real} <: FieldVector{2, R}
x::R
y::R
end

Point(1.0, 2)

currently causes a stack overflow (because it tries to construct a Point with a Float64 and an Int).

SVector currently handles this by promoting the arguments. Should FieldVector do something similar, or is there a fundamental issue with the design of FieldVector that prevents this?

This can cause confusing errors, e.g. calculating the jacobian with ForwardDiff of the function here: JuliaDiff/ForwardDiff.jl@d953ba0#diff-30d7dfc19018c9a0eb3e06548b8d98eeR185 can cause a stack overflow because of this. (JuliaDiff/ForwardDiff.jl#307)

@c42f c42f added the bug label Jul 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants