Cannot ForwardDiff through linear least squares via QR

There is an older but similar question here that might give some pointers: Using ForwardDiff on qr factorization