From 0e5fed74e7ab6f55ff5d4a0fcf88b0e18991e4e8 Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Thu, 28 May 2015 10:14:38 -0700 Subject: [PATCH] Worked around some constexpr related bugs in nvcc 7 --- .../Eigen/CXX11/src/Tensor/TensorIndexList.h | 2 +- .../Eigen/CXX11/src/Tensor/TensorReduction.h | 28 +++++++++++-------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h b/unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h index eed0a9f05..620b6a8cb 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h @@ -10,7 +10,7 @@ #ifndef EIGEN_CXX11_TENSOR_TENSOR_INDEX_LIST_H #define EIGEN_CXX11_TENSOR_TENSOR_INDEX_LIST_H -#ifdef EIGEN_HAS_CONSTEXPR +#if defined(EIGEN_HAS_CONSTEXPR) && defined(EIGEN_HAS_VARIADIC_TEMPLATES) namespace Eigen { diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h b/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h index de5747905..95116aaee 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h @@ -53,28 +53,34 @@ struct preserve_inner_most_dims { static const bool value = false; }; -#ifdef EIGEN_HAS_CONSTEXPR +#if defined(EIGEN_HAS_CONSTEXPR) && defined(EIGEN_HAS_VARIADIC_TEMPLATES) template struct are_inner_most_dims{ - static const bool value = indices_statically_known_to_increase()() && - index_statically_eq()(0, 0) && - index_statically_eq()(array_size::value-1, array_size::value-1); + static const bool tmp1 = indices_statically_known_to_increase()(); + static const bool tmp2 = index_statically_eq()(0, 0); + static const bool tmp3 = index_statically_eq()(array_size::value-1, array_size::value-1); + static const bool value = tmp1 & tmp2 & tmp3; }; template struct are_inner_most_dims{ - static const bool value = indices_statically_known_to_increase()() && - index_statically_eq()(0, NumTensorDims - array_size::value) && - index_statically_eq()(array_size::value - 1, NumTensorDims - 1); + static const bool tmp1 = indices_statically_known_to_increase()(); + static const bool tmp2 = index_statically_eq()(0, NumTensorDims - array_size::value); + static const bool tmp3 = index_statically_eq()(array_size::value - 1, NumTensorDims - 1); + static const bool value = tmp1 & tmp2 & tmp3; + }; template struct preserve_inner_most_dims{ - static const bool value = indices_statically_known_to_increase()() && - index_statically_gt()(0, 0); + static const bool tmp1 = indices_statically_known_to_increase()(); + static const bool tmp2 = index_statically_gt()(0, 0); + static const bool value = tmp1 & tmp2; + }; template struct preserve_inner_most_dims{ - static const bool value = indices_statically_known_to_increase()() && - index_statically_lt()(array_size::value - 1, NumTensorDims - 1); + static const bool tmp1 = indices_statically_known_to_increase()(); + static const bool tmp2 = index_statically_lt()(array_size::value - 1, NumTensorDims - 1); + static const bool value = tmp1 & tmp2; }; #endif