@@ -259,7 +259,7 @@ T& back(
259259 template <bool EnablePadding, class ... Rest, class F , class ... Args,
260260 class ... fArgTypes ,
261261 typename std::enable_if<EnablePadding, bool >::type = true >
262- constexpr CUDA_HOST_DEVICE return_type_t <F>
262+ CLAD_CONSTEXPR_CXX14 CUDA_HOST_DEVICE return_type_t <F>
263263 execute_with_default_args (list<Rest...>, F f, list<fArgTypes ...>,
264264 CUDA_ARGS CUDA_REST_ARGS Args&&... args) {
265265#if defined(__CUDACC__) && !defined(__CUDA_ARCH__)
@@ -286,7 +286,7 @@ T& back(
286286 template <bool EnablePadding, class ... Rest, class F , class ... Args,
287287 class ... fArgTypes ,
288288 typename std::enable_if<!EnablePadding, bool >::type = true >
289- constexpr return_type_t <F>
289+ CLAD_CONSTEXPR_CXX14 return_type_t <F>
290290 execute_with_default_args (list<Rest...>, F f, list<fArgTypes ...>,
291291 CUDA_ARGS CUDA_REST_ARGS Args&&... args) {
292292#if defined(__CUDACC__) && !defined(__CUDA_ARCH__)
@@ -316,7 +316,7 @@ T& back(
316316 template <bool EnablePadding, class ... Rest, class ReturnType , class C ,
317317 class Obj , class ... Args, class ... fArgTypes ,
318318 typename std::enable_if<!EnablePadding, bool >::type = true >
319- constexpr auto
319+ CLAD_CONSTEXPR_CXX14 auto
320320 execute_with_default_args (list<Rest...>, ReturnType C::*f, Obj&& obj,
321321 list<fArgTypes ...>,
322322 Args&&... args) -> return_type_t <decltype (f)> {
@@ -414,8 +414,9 @@ T& back(
414414
415415 template <typename ... Args, class FnType = CladFunctionType>
416416 typename std::enable_if<!std::is_same<FnType, NoFunction*>::value,
417- return_type_t <F>>::type constexpr CUDA_HOST_DEVICE
418- execute (Args&&... args) const {
417+ return_type_t <F>>::type
418+ CLAD_CONSTEXPR_CXX14 CUDA_HOST_DEVICE
419+ execute (Args&&... args) const {
419420 if (!m_Function)
420421 return static_cast <return_type_t <F>>(return_type_t <F>());
421422 if (m_CUDAkernel) {
@@ -425,9 +426,9 @@ T& back(
425426 // here static_cast is used to achieve perfect forwarding
426427#ifdef __CUDACC__
427428 return execute_helper (m_Function, m_CUDAkernel, dim3 (0 ), dim3 (0 ),
428- static_cast <Args>(args)...);
429+ std::forward <Args>(args)...);
429430#else
430- return execute_helper (m_Function, static_cast <Args>(args)...);
431+ return execute_helper (m_Function, std::forward <Args>(args)...);
431432#endif
432433 }
433434
@@ -463,12 +464,13 @@ T& back(
463464 }
464465
465466 template <typename ... Args>
466- constexpr CUDA_HOST_DEVICE auto operator ()(Args&&... args) const {
467+ constexpr CUDA_HOST_DEVICE auto operator ()(Args&&... args) const
468+ -> decltype(this ->execute (std::forward<Args>(args)...)) {
467469 return execute (std::forward<Args>(args)...);
468470 }
469471
470472 // / Return the string representation for the generated derivative.
471- constexpr const char * getCode () const {
473+ CLAD_CONSTEXPR_CXX14 const char * getCode () const {
472474 if (m_Code)
473475 return m_Code;
474476 return " <invalid>" ;
@@ -498,7 +500,7 @@ T& back(
498500 private:
499501 // / Helper function for executing non-member derived functions.
500502 template <class Fn , class ... Args>
501- constexpr CUDA_HOST_DEVICE return_type_t <CladFunctionType>
503+ CLAD_CONSTEXPR_CXX14 CUDA_HOST_DEVICE return_type_t <CladFunctionType>
502504 execute_helper (Fn f, CUDA_ARGS Args&&... args) const {
503505 // `static_cast` is required here for perfect forwarding.
504506#if defined(__CUDACC__)
@@ -541,7 +543,7 @@ T& back(
541543 class = typename std::enable_if<std::is_same<
542544 typename std::decay<Obj>::type, C>::value>::type,
543545 class ... Args>
544- constexpr return_type_t <CladFunctionType>
546+ CLAD_CONSTEXPR_CXX14 return_type_t <CladFunctionType>
545547 execute_helper (ReturnType C::*f, Obj&& obj, Args&&... args) const {
546548 // `static_cast` is required here for perfect forwarding.
547549 return execute_with_default_args<EnablePadding>(
@@ -554,7 +556,7 @@ T& back(
554556 // / will be used and derived function will be called through the object
555557 // / saved in `CladFunction`.
556558 template <class ReturnType , class C , class ... Args>
557- constexpr return_type_t <CladFunctionType>
559+ CLAD_CONSTEXPR_CXX14 return_type_t <CladFunctionType>
558560 execute_helper (ReturnType C::*f, Args&&... args) const {
559561 // `static_cast` is required here for perfect forwarding.
560562 return execute_with_default_args<EnablePadding>(
0 commit comments