From e13071dd13233b5d07e725453617c40421cf7501 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Mon, 5 Sep 2016 15:50:41 +0200 Subject: Workaround a weird msvc 2012 compilation error. --- test/nullary.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/nullary.cpp') diff --git a/test/nullary.cpp b/test/nullary.cpp index ad306c1e9..a3c8b991e 100644 --- a/test/nullary.cpp +++ b/test/nullary.cpp @@ -170,5 +170,19 @@ void test_nullary() VERIFY(( internal::has_unary_operator >::value )); VERIFY(( !internal::has_binary_operator >::value )); VERIFY(( internal::functor_has_linear_access >::ret )); + + // Regression unit test for a weird MSVC 2012 bug. + // Search "nullary_wrapper_workaround_msvc_2012" in CoreEvaluators.h for the details. + { + MatrixXf A = MatrixXf::Random(3,3); + Ref R = 2.0*A; + VERIFY_IS_APPROX(R, A+A); + + Ref R1 = MatrixXf::Random(3,3)+A; + + VectorXi V = VectorXi::Random(3); + Ref R2 = VectorXi::LinSpaced(3,1,3)+V; + VERIFY_IS_APPROX(R2, V+Vector3i(1,2,3)); + } #endif } -- cgit v1.2.3