diff --git a/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h b/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h index 4fc003d63..371160c24 100644 --- a/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h +++ b/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h @@ -221,9 +221,11 @@ class AutoDiffScalar return AutoDiffScalar(m_value - b, m_derivatives); } - friend inline const AutoDiffScalar operator-(const Scalar& a, const AutoDiffScalar& b) + friend inline const AutoDiffScalar, const DerType> > + operator-(const Scalar& a, const AutoDiffScalar& b) { - return AutoDiffScalar(a - b.value(), b.derivatives()); + return AutoDiffScalar, const DerType> > + (a - b.value(), -b.derivatives()); } template