From bf79a3199c87ccfa254b3e4a4111888c010f2c52 Mon Sep 17 00:00:00 2001 From: Hauke Heibel Date: Fri, 11 Feb 2011 09:41:48 +0100 Subject: [PATCH] Reduced error traces when mixing matrices with different scalar types. --- Eigen/src/Core/Matrix.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Eigen/src/Core/Matrix.h b/Eigen/src/Core/Matrix.h index d304fad60..2b7202c62 100644 --- a/Eigen/src/Core/Matrix.h +++ b/Eigen/src/Core/Matrix.h @@ -285,6 +285,11 @@ class Matrix EIGEN_STRONG_INLINE Matrix(const MatrixBase& other) : Base(other.rows() * other.cols(), other.rows(), other.cols()) { + // This test resides here, to bring the error messages closer to the user. Normally, these checks + // are performed deeply within the library, thus causing long and scary error traces. + EIGEN_STATIC_ASSERT((internal::is_same::value), + YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) + Base::_check_template_params(); Base::_set_noalias(other); }