From c50250cb241abb3ea90bac86bc1c27dfadd0862c Mon Sep 17 00:00:00 2001 From: Christoph Hertzberg Date: Thu, 20 Sep 2018 17:03:42 +0200 Subject: [PATCH 1/2] Avoid warning "suggest braces around initialization of subobject". This test is not run in C++03 mode, so no compatibility is lost. --- unsupported/test/cxx11_tensor_shuffling.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/unsupported/test/cxx11_tensor_shuffling.cpp b/unsupported/test/cxx11_tensor_shuffling.cpp index 062dd1c0f..2ec85d2d4 100644 --- a/unsupported/test/cxx11_tensor_shuffling.cpp +++ b/unsupported/test/cxx11_tensor_shuffling.cpp @@ -83,10 +83,10 @@ static void test_expr_shuffling() Tensor result(5, 7, 3, 2); - array src_slice_dim({2, 3, 1, 7}); - array src_slice_start({0, 0, 0, 0}); - array dst_slice_dim({1, 7, 3, 2}); - array dst_slice_start({0, 0, 0, 0}); + array src_slice_dim{{2, 3, 1, 7}}; + array src_slice_start{{0, 0, 0, 0}}; + array dst_slice_dim{{1, 7, 3, 2}}; + array dst_slice_start{{0, 0, 0, 0}}; for (int i = 0; i < 5; ++i) { result.slice(dst_slice_start, dst_slice_dim) = From a0166ab6514d47bad8db2502c460953af811ea38 Mon Sep 17 00:00:00 2001 From: Christoph Hertzberg Date: Thu, 20 Sep 2018 17:08:43 +0200 Subject: [PATCH 2/2] Workaround for spurious "array subscript is above array bounds" warnings with g++4.x --- unsupported/Eigen/CXX11/src/util/EmulateArray.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unsupported/Eigen/CXX11/src/util/EmulateArray.h b/unsupported/Eigen/CXX11/src/util/EmulateArray.h index d5c000e08..39c255791 100644 --- a/unsupported/Eigen/CXX11/src/util/EmulateArray.h +++ b/unsupported/Eigen/CXX11/src/util/EmulateArray.h @@ -21,9 +21,9 @@ namespace Eigen { template class array { public: EIGEN_DEVICE_FUNC - EIGEN_STRONG_INLINE T& operator[] (size_t index) { return values[index]; } + EIGEN_STRONG_INLINE T& operator[] (size_t index) { eigen_internal_assert(index < size()); return values[index]; } EIGEN_DEVICE_FUNC - EIGEN_STRONG_INLINE const T& operator[] (size_t index) const { return values[index]; } + EIGEN_STRONG_INLINE const T& operator[] (size_t index) const { eigen_internal_assert(index < size()); return values[index]; } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T& at(size_t index) { eigen_assert(index < size()); return values[index]; }