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
diff --git a/libcxx/test/support/charconv_test_helpers.h b/libcxx/test/support/charconv_test_helpers.h
index dc704a9..f30956e 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 @@
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 @@
}
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 @@
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 @@
}
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>());
}