mutable struct A
x::Float64
const y::Float64
end
make_zero(A, IdDict(), A(0.0, 0.0), Val(false))
fails with the following stacktrace
setfield!: const field .y of type B cannot be changed
Stacktrace:
[1] make_zero(::Type{B}, seen::IdDict{Any, Any}, prev::B, ::Val{false})
@ Enzyme.Compiler ~/.julia/packages/Enzyme/HXYPU/src/compiler.jl:1948
make_zero is not checking whether the field is const (which can be done using isconst(A, :y) or isconst(A, 2))
fails with the following stacktrace
make_zero
is not checking whether the field is const (which can be done usingisconst(A, :y)
orisconst(A, 2)
)