diff --git a/include/eigenpy/eigen-allocator.hpp b/include/eigenpy/eigen-allocator.hpp
index 2ca889dbe2e1e73d2e3be51d8bbd34a127e792c2..650da8dd95b0681c07de46fcf9b3291235ce4097 100644
--- a/include/eigenpy/eigen-allocator.hpp
+++ b/include/eigenpy/eigen-allocator.hpp
@@ -245,7 +245,8 @@ inline bool is_arr_layout_compatible_with_mat_type(PyArrayObject *pyArray) {
   bool is_array_F_cont = PyArray_IS_F_CONTIGUOUS(pyArray);
   return (MatType::IsRowMajor && is_array_C_cont) ||
          (!MatType::IsRowMajor && is_array_F_cont) ||
-         MatType::IsVectorAtCompileTime;
+         (MatType::IsVectorAtCompileTime &&
+          (is_array_C_cont || is_array_F_cont));
 }
 
 template <typename MatType, int Options, typename Stride>