aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/nullary.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/nullary.cpp')
-rw-r--r--test/nullary.cpp14
1 files changed, 14 insertions, 0 deletions
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<internal::linspaced_op<float,float,false> >::value ));
VERIFY(( !internal::has_binary_operator<internal::linspaced_op<float,float,false> >::value ));
VERIFY(( internal::functor_has_linear_access<internal::linspaced_op<float,float,false> >::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<const MatrixXf> R = 2.0*A;
+ VERIFY_IS_APPROX(R, A+A);
+
+ Ref<const MatrixXf> R1 = MatrixXf::Random(3,3)+A;
+
+ VectorXi V = VectorXi::Random(3);
+ Ref<const VectorXi> R2 = VectorXi::LinSpaced(3,1,3)+V;
+ VERIFY_IS_APPROX(R2, V+Vector3i(1,2,3));
+ }
#endif
}