ForwardDiff needs a lot more than just opening up type signatures to work with complex numbers, so I wouldn’t expect this to just work any time soon. You can split to real and imaginary parts and diff that. We are making essentially a ForwardDiff 2.0 (with Jarrett’s blessing ) to address this, along with the lack of multivariate rules (use BLAS!) and post-hoc rule definition (via ChainRules).
Also, you will be able to do this type of automatic differentiation with Grassmann.jl after I finish implementing the Leibniz.jl package for working with the symmetric differentials. Complex number algebra is simply a subalgera of the geometric algebra in Grassmann and by extending it with the symmetric Leibniz algebra the automatic differentiation is automatically built-in, as described in my paper.
julia> using Grassmann, basis"2"
(⟨++⟩, v, v₁, v₂, v₁₂)
julia> f2(t) = real(sqrt(cos(t)+vectorspace(t)(I)*sin(t)))
f2 (generic function with 1 method)
All of the methods needed for your AD example are already implemented in Grassmann variables so now I only need to finish implementing the extended support for the Leibniz indices and then you will be able to also tack on the derivatives also to get the forward mode AD.