From cc2f6d68b192bcce576ee8c0008c4c4b1f2f62ff Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Wed, 27 Jul 2016 23:30:47 +0200 Subject: [PATCH] bug #1264: fix compilation --- unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h | 9 +++++---- unsupported/test/autodiff.cpp | 8 ++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h b/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h index 2db4d8c3b..50fedf6ac 100755 --- a/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h +++ b/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h @@ -666,13 +666,14 @@ EIGEN_AUTODIFF_DECLARE_GLOBAL_UNARY(cosh, #undef EIGEN_AUTODIFF_DECLARE_GLOBAL_UNARY template struct NumTraits > - : NumTraits< typename NumTraits::Real > + : NumTraits< typename NumTraits::type::Scalar>::Real > { - typedef AutoDiffScalar::Real,DerType::RowsAtCompileTime,DerType::ColsAtCompileTime, - 0, DerType::MaxRowsAtCompileTime, DerType::MaxColsAtCompileTime> > Real; + typedef typename internal::remove_all::type DerTypeCleaned; + typedef AutoDiffScalar::Real,DerTypeCleaned::RowsAtCompileTime,DerTypeCleaned::ColsAtCompileTime, + 0, DerTypeCleaned::MaxRowsAtCompileTime, DerTypeCleaned::MaxColsAtCompileTime> > Real; typedef AutoDiffScalar NonInteger; typedef AutoDiffScalar Nested; - typedef typename NumTraits::Literal Literal; + typedef typename NumTraits::Literal Literal; enum{ RequireInitialization = 1 }; diff --git a/unsupported/test/autodiff.cpp b/unsupported/test/autodiff.cpp index 118cf2ec7..2da6dd8f3 100644 --- a/unsupported/test/autodiff.cpp +++ b/unsupported/test/autodiff.cpp @@ -256,6 +256,14 @@ double bug_1261() { return maxVal.value() + minVal.value(); } +double bug_1264() { + typedef AutoDiffScalar AD; + const AD s; + const Matrix v1; + const Matrix v2 = (s + 3.0) * v1; + return v2(0).value(); +} + void test_autodiff() { for(int i = 0; i < g_repeat; i++) {