diff options
author | Marshall Clow <mclow.lists@gmail.com> | 2019-03-20 18:13:23 +0000 |
---|---|---|
committer | Marshall Clow <mclow.lists@gmail.com> | 2019-03-20 18:13:23 +0000 |
commit | 769c2459d5c201d98c9e96c868dae94e4c7ec1a2 (patch) | |
tree | 99ec37adb52239306c70984b6d63281938809a2b /libcxx/test/support/charconv_test_helpers.h | |
parent | 37cf25c3c6819d3ed55915903b5cea91f9d367b0 (diff) | |
download | bcm5719-llvm-769c2459d5c201d98c9e96c868dae94e4c7ec1a2.tar.gz bcm5719-llvm-769c2459d5c201d98c9e96c868dae94e4c7ec1a2.zip |
Make to_chars/from_chars work back to C++11. This means that we can use them to implement to_string as well. Reviewed as https://reviews.llvm.org/D59598.
llvm-svn: 356585
Diffstat (limited to 'libcxx/test/support/charconv_test_helpers.h')
-rw-r--r-- | libcxx/test/support/charconv_test_helpers.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libcxx/test/support/charconv_test_helpers.h b/libcxx/test/support/charconv_test_helpers.h index dc704a925a3..f30956e9a73 100644 --- a/libcxx/test/support/charconv_test_helpers.h +++ b/libcxx/test/support/charconv_test_helpers.h @@ -17,8 +17,8 @@ #include "test_macros.h" -#if TEST_STD_VER <= 11 -#error This file requires C++14 +#if TEST_STD_VER < 11 +#error This file requires C++11 #endif using std::false_type; @@ -56,14 +56,14 @@ template <typename X, typename T, typename xl = std::numeric_limits<X>> constexpr bool _fits_in(T v, false_type, true_type /* T signed */, false_type /* X unsigned*/) { - return 0 <= v && std::make_unsigned_t<T>(v) <= (xl::max)(); + return 0 <= v && typename std::make_unsigned<T>::type(v) <= (xl::max)(); } template <typename X, typename T, typename xl = std::numeric_limits<X>> constexpr bool _fits_in(T v, false_type, false_type /* T unsigned */, ...) { - return v <= std::make_unsigned_t<X>((xl::max)()); + return v <= typename std::make_unsigned<X>::type((xl::max)()); } template <typename X, typename T> @@ -119,7 +119,7 @@ struct to_chars_test_base } private: - static auto fromchars(char const* p, char const* ep, int base, true_type) + static long long fromchars(char const* p, char const* ep, int base, true_type) { char* last; auto r = strtoll(p, &last, base); @@ -128,7 +128,7 @@ private: return r; } - static auto fromchars(char const* p, char const* ep, int base, false_type) + static unsigned long long fromchars(char const* p, char const* ep, int base, false_type) { char* last; auto r = strtoull(p, &last, base); @@ -138,6 +138,7 @@ private: } static auto fromchars(char const* p, char const* ep, int base = 10) + -> decltype(fromchars(p, ep, base, std::is_signed<X>())) { return fromchars(p, ep, base, std::is_signed<X>()); } |