From 1e33818e358799e3a32dbd8723888fefbc432bcd Mon Sep 17 00:00:00 2001 From: Tobias Leibner <tobias.leibner@googlemail.com> Date: Mon, 31 Aug 2020 10:24:34 +0200 Subject: [PATCH] fix compilation with icc --- dune/pybindxi/cast.h | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/dune/pybindxi/cast.h b/dune/pybindxi/cast.h index 63e90a9c2..9a8ab9b05 100644 --- a/dune/pybindxi/cast.h +++ b/dune/pybindxi/cast.h @@ -2606,23 +2606,18 @@ private: dict m_kwargs; }; -/// Collect only positional arguments for a Python function call -template <return_value_policy policy, typename... Args, typename = enable_if_t<all_of<is_positional<Args>...>::value>> -simple_collector<policy> collect_arguments(Args&&... args) -{ - return simple_collector<policy>(std::forward<Args>(args)...); -} - -/// Collect all arguments, including keywords and unpacking (only instantiated when needed) -template <return_value_policy policy, typename... Args, typename = enable_if_t<!all_of<is_positional<Args>...>::value>> -unpacking_collector<policy> collect_arguments(Args&&... args) +template <return_value_policy policy, typename... Args> +auto collect_arguments(Args&&... args) { - // Following argument order rules for generalized unpacking according to PEP 448 - static_assert(constexpr_last<is_positional, Args...>() < constexpr_first<is_keyword_or_ds, Args...>() - && constexpr_last<is_s_unpacking, Args...>() < constexpr_first<is_ds_unpacking, Args...>(), - "Invalid function call: positional args must precede keywords and ** unpacking; " - "* unpacking must precede ** unpacking"); - return unpacking_collector<policy>(std::forward<Args>(args)...); + if constexpr (all_of<is_positional<Args>...>::value) { + return simple_collector<policy>(std::forward<Args>(args)...); + } else { + static_assert(constexpr_last<is_positional, Args...>() < constexpr_first<is_keyword_or_ds, Args...>() + && constexpr_last<is_s_unpacking, Args...>() < constexpr_first<is_ds_unpacking, Args...>(), + "Invalid function call: positional args must precede keywords and ** unpacking; " + "* unpacking must precede ** unpacking"); + return unpacking_collector<policy>(std::forward<Args>(args)...); + } } template <typename Derived> -- GitLab