From 17c40e5524923873cfbd5181b96fbb9e8df20bfd Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Wed, 18 May 2016 16:00:11 +0200 Subject: [PATCH] bug #1222: fix compilation in AutoDiffScalar and add respective unit test (grafted from 448d9d943c3996f6d74cebad457865d005248ddd ) --- unsupported/test/autodiff.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/unsupported/test/autodiff.cpp b/unsupported/test/autodiff.cpp index 087e7c542..7c112a1f0 100644 --- a/unsupported/test/autodiff.cpp +++ b/unsupported/test/autodiff.cpp @@ -162,6 +162,15 @@ void test_autodiff_jacobian() CALL_SUBTEST(( forward_jacobian(TestFunc1(3,3)) )); } +double bug_1222() { + typedef Eigen::AutoDiffScalar AD; + const double _cv1_3 = 1.0; + const AD chi_3 = 1.0; + // this line did not work, because operator+ returns ADS, which then cannot be converted to ADS + const AD denom = chi_3 + _cv1_3; + return denom.value(); +} + void test_autodiff() { for(int i = 0; i < g_repeat; i++) { @@ -169,5 +178,7 @@ void test_autodiff() CALL_SUBTEST_2( test_autodiff_vector() ); CALL_SUBTEST_3( test_autodiff_jacobian() ); } + + bug_1222(); }