From 6056f4404c71f9047cb41959998836dc92e926c2 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Thu, 5 Nov 2015 15:36:48 +0100 Subject: [PATCH] fix unit test compilation --- test/rvalue_types.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/test/rvalue_types.cpp b/test/rvalue_types.cpp index b17b11500..b3c85652c 100644 --- a/test/rvalue_types.cpp +++ b/test/rvalue_types.cpp @@ -11,16 +11,17 @@ #include -template -void rvalue_copyassign(const MatrixType& ) -{ #ifdef EIGEN_HAVE_RVALUE_REFERENCES +template +void rvalue_copyassign(const MatrixType& m) +{ + typedef typename internal::traits::Scalar Scalar; - + // create a temporary which we are about to destroy by moving MatrixType tmp = m; long src_address = reinterpret_cast(tmp.data()); - + // move the temporary to n MatrixType n = std::move(tmp); long dst_address = reinterpret_cast(n.data()); @@ -34,8 +35,11 @@ void rvalue_copyassign(const MatrixType& ) // verify that the content did not change Scalar abs_diff = (m-n).array().abs().sum(); VERIFY_IS_EQUAL(abs_diff, Scalar(0)); -#endif } +#else +template +void rvalue_copyassign(const MatrixType&) {} +#endif void test_rvalue_types() { @@ -47,7 +51,7 @@ void test_rvalue_types() CALL_SUBTEST_1(rvalue_copyassign( Matrix::Random(50).eval() )); CALL_SUBTEST_1(rvalue_copyassign( Array::Random(50).eval() )); - + CALL_SUBTEST_2(rvalue_copyassign( Array::Random().eval() )); CALL_SUBTEST_2(rvalue_copyassign( Array::Random().eval() )); CALL_SUBTEST_2(rvalue_copyassign( Array::Random().eval() ));