Merged in ezhulenev/eigen-01 (pull request PR-726) Block evaluation for TensorChipping + fixed bugs in TensorPadding and TensorSlicing
diff --git a/Eigen/src/Core/util/Meta.h b/Eigen/src/Core/util/Meta.h index db948ce..fe9550d 100755 --- a/Eigen/src/Core/util/Meta.h +++ b/Eigen/src/Core/util/Meta.h
@@ -174,6 +174,11 @@ template<typename T> struct add_const_on_value_type<T* const> { typedef T const* const type; }; template<typename T> struct add_const_on_value_type<T const* const> { typedef T const* const type; }; +#if EIGEN_HAS_CXX11 + +using std::is_convertible; + +#else template<typename From, typename To> struct is_convertible_impl @@ -211,6 +216,14 @@ enum { value = is_convertible_impl<From,To>::value }; }; +template<typename T> +struct is_convertible<T,T&> { enum { value = false }; }; + +template<typename T> +struct is_convertible<const T,const T&> { enum { value = true }; }; + +#endif + /** \internal Allows to enable/disable an overload * according to a compile time condition. */
diff --git a/test/meta.cpp b/test/meta.cpp index ea9607f..b432d93 100644 --- a/test/meta.cpp +++ b/test/meta.cpp
@@ -87,8 +87,12 @@ STATIC_CHECK(( internal::is_convertible<const Matrix3f&,const Matrix3f&>::value )); STATIC_CHECK((!internal::is_convertible<const Matrix3f&,Matrix3f&>::value )); STATIC_CHECK((!internal::is_convertible<const Matrix3f,Matrix3f&>::value )); - STATIC_CHECK(( internal::is_convertible<Matrix3f,Matrix3f&>::value )); // std::is_convertible returns false here though Matrix3f from; Matrix3f& to = from; is valid. - //STATIC_CHECK((!internal::is_convertible<Matrix3f,Matrix3d>::value )); //does not work because the conversion is prevented by a static assertion + STATIC_CHECK(!( internal::is_convertible<Matrix3f,Matrix3f&>::value )); + + STATIC_CHECK(!( internal::is_convertible<int,int&>::value )); + STATIC_CHECK(( internal::is_convertible<const int,const int& >::value )); + + //STATIC_CHECK((!internal::is_convertible<Matrix3f,Matrix3d>::value )); //does not even compile because the conversion is prevented by a static assertion STATIC_CHECK((!internal::is_convertible<Array33f,int>::value )); STATIC_CHECK((!internal::is_convertible<MatrixXf,float>::value )); { @@ -101,6 +105,14 @@ VERIFY(( check_is_convertible(A*B, A) )); } + #if (EIGEN_COMP_GNUC && EIGEN_COMP_GNUC <= 99) \ + || (EIGEN_COMP_CLANG && EIGEN_COMP_CLANG <= 909) \ + || (EIGEN_COMP_MSVC && EIGEN_COMP_MSVC <=1914) + // See http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1752, + // basically, a fix in the c++ standard breaks our c++98 implementation + // of is_convertible for abstract classes. + // So the following tests are expected to fail with recent compilers. + STATIC_CHECK(( !internal::is_convertible<MyInterface, MyImpl>::value )); #if (!EIGEN_COMP_GNUC_STRICT) || (EIGEN_GNUC_AT_LEAST(4,8)) // GCC prior to 4.8 fails to compile this test: @@ -110,12 +122,16 @@ STATIC_CHECK(( !internal::is_convertible<MyImpl, MyInterface>::value )); #endif STATIC_CHECK(( internal::is_convertible<MyImpl, const MyInterface&>::value )); + + #endif + { int i; VERIFY(( check_is_convertible(fix<3>(), i) )); VERIFY((!check_is_convertible(i, fix<DynamicIndex>()) )); } + VERIFY(( internal::has_ReturnType<FooReturnType>::value )); VERIFY(( internal::has_ReturnType<ScalarBinaryOpTraits<int,int> >::value )); VERIFY(( !internal::has_ReturnType<MatrixXf>::value ));