From 5b1280600d2129bf9b2ce8b73343878533b82056 Mon Sep 17 00:00:00 2001 From: Allison Vacanti Date: Fri, 20 Dec 2019 16:17:30 -0500 Subject: [PATCH] Cleanup reference types when using declval. When expanding variadic parameter packs in ArrayHandleDecorator implementations, make sure that the types used are appropriate. Since std::declval is used to test whether or not a method with specific arguments exists, it is important that the reference types are correct to ensure that the detection works as expected. Portals are always passed to implementation functions as rvalue references, and array handles are always passed as lvalue refs. --- vtkm/cont/ArrayHandleDecorator.h | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/vtkm/cont/ArrayHandleDecorator.h b/vtkm/cont/ArrayHandleDecorator.h index 95af9e594..2ef8d9419 100644 --- a/vtkm/cont/ArrayHandleDecorator.h +++ b/vtkm/cont/ArrayHandleDecorator.h @@ -125,11 +125,9 @@ template class List, typename.. struct IsFunctorInvertibleImpl> { private: - using PortalList = brigand::list::type...>; - template < typename T, - typename U = decltype(std::declval().CreateInverseFunctor(std::declval()...))> + typename U = decltype(std::declval().CreateInverseFunctor(std::declval()...))> static std::true_type InverseExistsTest(int); template @@ -147,7 +145,8 @@ struct GetFunctorTypeImpl; template class List, typename... PortalTs> struct GetFunctorTypeImpl> { - using type = decltype(std::declval().CreateFunctor(std::declval()...)); + using type = + decltype(std::declval().CreateFunctor(std::declval()...)); }; // Deduces the type returned by DecoratorImplT::CreateInverseFunctor when given @@ -160,7 +159,7 @@ template class List, typename.. struct GetInverseFunctorTypeImpl> { using type = - decltype(std::declval().CreateInverseFunctor(std::declval()...)); + decltype(std::declval().CreateInverseFunctor(std::declval()...)); }; template @@ -328,19 +327,19 @@ using GetInverseFunctorType = // - So we jump through some decltype/declval hoops here to get this to work: template using GetPortalConstControlList = - brigand::list())))...>; + brigand::list())))...>; template using GetPortalConstExecutionList = - brigand::list(), Device{})))...>; + brigand::list(), Device{})))...>; template using GetPortalControlList = - brigand::list())))...>; + brigand::list())))...>; template using GetPortalExecutionList = - brigand::list(), Device{})))...>; + brigand::list(), Device{})))...>; template struct DecoratorStorageTraits