From fd5f48e465ab011c64e989c4e1f656a8e4b6ebf1 Mon Sep 17 00:00:00 2001 From: Antonio Sanchez Date: Wed, 29 Sep 2021 20:34:03 -0700 Subject: [PATCH] Fix tuple compilation for VS2017. VS2017 doesn't like deducing alias types, leading to a bunch of compile errors for functions involving the `tuple` alias. Replacing with `TupleImpl` seems to solve this, allowing the test to compile/pass. --- Eigen/src/Core/arch/GPU/Tuple.h | 26 +++++++++++++------------- test/tuple_test.cpp | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Eigen/src/Core/arch/GPU/Tuple.h b/Eigen/src/Core/arch/GPU/Tuple.h index d381cd886..bbcdf64ff 100644 --- a/Eigen/src/Core/arch/GPU/Tuple.h +++ b/Eigen/src/Core/arch/GPU/Tuple.h @@ -217,12 +217,6 @@ struct unwrap_decay { using type = typename unwrap_reference_wrapper::type>::type; }; -/** - * Alternative to std::tuple that can be used on device. - */ -template -using tuple = TupleImpl; - /** * Utility for determining a tuple's size. */ @@ -230,7 +224,7 @@ template struct tuple_size; template -struct tuple_size< tuple > : std::integral_constant {}; +struct tuple_size< TupleImpl > : std::integral_constant {}; /** * Gets an element of a tuple. @@ -242,14 +236,14 @@ struct tuple_size< tuple > : std::integral_constant EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename tuple_get_impl::ReturnType& -get(const tuple& tuple) { +get(const TupleImpl& tuple) { return tuple_get_impl::run(tuple); } template EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename tuple_get_impl::ReturnType& -get(tuple& tuple) { +get(TupleImpl& tuple) { return tuple_get_impl::run(tuple); } @@ -271,7 +265,7 @@ tuple_cat(Tuples&&... tuples) { /** * Tie arguments together into a tuple. */ -template > +template > EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ReturnType tie(Args&... args) EIGEN_NOEXCEPT { return ReturnType{args...}; @@ -280,7 +274,7 @@ ReturnType tie(Args&... args) EIGEN_NOEXCEPT { /** * Create a tuple of l-values with the supplied arguments. */ -template ::type...> > +template ::type...> > EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ReturnType make_tuple(Args&&... args) { return ReturnType{std::forward(args)...}; @@ -291,10 +285,16 @@ ReturnType make_tuple(Args&&... args) { */ template EIGEN_CONSTEXPR EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE -tuple forward_as_tuple(Args&&... args) { - return tuple(std::forward(args)...); +TupleImpl forward_as_tuple(Args&&... args) { + return TupleImpl(std::forward(args)...); } +/** + * Alternative to std::tuple that can be used on device. + */ +template +using tuple = TupleImpl; + } // namespace tuple_impl } // namespace internal } // namespace Eigen diff --git a/test/tuple_test.cpp b/test/tuple_test.cpp index 8d8a5aacc..c3bbe37b7 100644 --- a/test/tuple_test.cpp +++ b/test/tuple_test.cpp @@ -99,7 +99,7 @@ void basic_tuple_test() { VERIFY_IS_EQUAL(x, tuple_impl::get<0>(tuple3)); VERIFY_IS_EQUAL(y, tuple_impl::get<1>(tuple3)); VERIFY_IS_EQUAL(z, tuple_impl::get<2>(tuple3)); - tuple tuple3c(-2, -2, -2); + tuple tuple3c(-2, -2.0f, -2.0); tuple3c = std::move(tuple3b); VERIFY_IS_EQUAL(tuple_impl::get<0>(tuple3c), tuple_impl::get<0>(tuple3)); VERIFY_IS_EQUAL(tuple_impl::get<1>(tuple3c), tuple_impl::get<1>(tuple3));