diff options
author | Ayaz Salikhov <mathbunnyru@gmail.com> | 2019-01-18 11:53:25 (GMT) |
---|---|---|
committer | Ayaz Salikhov <mathbunnyru@gmail.com> | 2019-01-18 11:53:56 (GMT) |
commit | 7c4164bf404d899b6d4c74beb1070da5647f55a2 (patch) | |
tree | 8bc6f7d761ae7657d7716e26f77cb549714d4930 /googletest/include/gtest/internal | |
parent | 0adeadd2830211f827fd2908e4621f6a4afa810c (diff) | |
download | googletest-7c4164bf404d899b6d4c74beb1070da5647f55a2.zip googletest-7c4164bf404d899b6d4c74beb1070da5647f55a2.tar.gz googletest-7c4164bf404d899b6d4c74beb1070da5647f55a2.tar.bz2 |
Fix INSTANTIATE_TEST_CASE_P with zero variadic arguments
Diffstat (limited to 'googletest/include/gtest/internal')
-rw-r--r-- | googletest/include/gtest/internal/gtest-param-util.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/googletest/include/gtest/internal/gtest-param-util.h b/googletest/include/gtest/internal/gtest-param-util.h index bca7253..e059222 100644 --- a/googletest/include/gtest/internal/gtest-param-util.h +++ b/googletest/include/gtest/internal/gtest-param-util.h @@ -41,6 +41,7 @@ #include <memory> #include <set> #include <tuple> +#include <type_traits> #include <utility> #include <vector> @@ -398,6 +399,30 @@ typename ParamNameGenFunc<ParamType>::Type *GetParamNameGen() { // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // +// Macroses allow to address an issue with zero element variadic macro + +#define EXPAND(X) X +#define VA__GETFIRST(X, ...) X +#define VA_GETFIRST(...) EXPAND(VA__GETFIRST(__VA_ARGS__, 0)) +#define VA_GETREST(X, ...) __VA_ARGS__ + +// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. +// +// Function is intended to swallow 0 as last argument and call GetParamNameGen + +template <class ParamType> +auto CreateParamGenerator(int) -> decltype(GetParamNameGen<ParamType>()) { + return GetParamNameGen<ParamType>(); +} + +template <class ParamType, class Arg> +auto CreateParamGenerator(Arg&& arg, int) -> decltype( + GetParamNameGen<ParamType>(std::forward<Arg>(arg))) { + return GetParamNameGen<ParamType>(std::forward<Arg>(arg)); +} + +// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. +// // Stores a parameter value and later creates tests parameterized with that // value. template <class TestClass> |