If I do this,

```
// [[Rcpp::depends(BH)]]
// [[Rcpp::depends(RcppEigen)]]
// [[Rcpp::depends(StanHeaders)]]
#include <Rcpp.h>
#include <RcppEigen.h>
#include <stan/math/mix/mat/functor/hessian.hpp>
#include <stan/math/fwd/mat/fun/dot_self.hpp>
#include <stan/math.hpp>
// [[Rcpp::export]]
Eigen::MatrixXd H(Eigen::VectorXd x, Eigen::VectorXd a) { // Hessian by AD using Stan
double fx;
Eigen::VectorXd grad_fx;
Eigen::MatrixXd H;
stan::math::hessian([&a](auto x) {
auto z = x.eval();
for (int i = 0; i < x.rows(); i++) z.coeffRef(i) -= a.coeff(i);
return stan::math::dot_self(z);
}, x, fx, grad_fx, H);
return H;
}
```

and call `Rcpp::sourceCpp`

on that file, then I can call `H()`

from R. But if I change the function definition to

```
// [[Rcpp::export]]
Eigen::MatrixXd H(Eigen::VectorXd x, Eigen::VectorXd a) { // Hessian by AD using Stan
double fx;
Eigen::VectorXd grad_fx;
Eigen::MatrixXd H;
stan::math::hessian([&a](auto x) {
return stan::math::dot_self( (x - a).eval() );
}, x, fx, grad_fx, H);
return H;
}
```

it fails with

/home/ben/R/x86_64-pc-linux-gnu-library/3.3/RcppEigen/include/Eigen/src/Core/CwiseBinaryOp.h:107:7: error: static_assert failed due to requirement ‘Eigen::internal::has_ReturnType<ScalarBinaryOpTraits<typename Lhs::Scalar, typename Rhs::Scalar, scalar_difference_op<fvar, double> > >::value’ “YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY”

EIGEN_CHECK_BINARY_COMPATIBILIY(BinaryOp,typename Lhs::Scalar,typename Rhs::Scalar);

Why is subtracting a double vector from a `fvar<double>`

vector illegal while subtracting a double from a `fvar<double>`

is legal?