mirror of
https://github.com/fastfloat/fast_float.git
synced 2026-02-07 10:19:52 +08:00
check for HAS_CXX20_CONSTEXPR before attempting to do c++20 stuff
This commit is contained in:
parent
e5d5e576a6
commit
4e13ec151b
@ -12,6 +12,7 @@
|
|||||||
#if defined(__cpp_lib_bit_cast)
|
#if defined(__cpp_lib_bit_cast)
|
||||||
#undef CXX20_CONSTEXPR
|
#undef CXX20_CONSTEXPR
|
||||||
#define CXX20_CONSTEXPR constexpr
|
#define CXX20_CONSTEXPR constexpr
|
||||||
|
#define HAS_CXX20_CONSTEXPR 1
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -81,6 +81,7 @@
|
|||||||
#if defined(__cpp_lib_bit_cast)
|
#if defined(__cpp_lib_bit_cast)
|
||||||
#undef CXX20_CONSTEXPR
|
#undef CXX20_CONSTEXPR
|
||||||
#define CXX20_CONSTEXPR constexpr
|
#define CXX20_CONSTEXPR constexpr
|
||||||
|
#define HAS_CXX20_CONSTEXPR 1
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -5,7 +5,6 @@
|
|||||||
#include "fast_float/fast_float.h"
|
#include "fast_float/fast_float.h"
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <version>
|
|
||||||
|
|
||||||
#ifndef SUPPLEMENTAL_TEST_DATA_DIR
|
#ifndef SUPPLEMENTAL_TEST_DATA_DIR
|
||||||
#define SUPPLEMENTAL_TEST_DATA_DIR "data/"
|
#define SUPPLEMENTAL_TEST_DATA_DIR "data/"
|
||||||
@ -38,7 +37,7 @@
|
|||||||
#define FASTFLOAT_ODDPLATFORM 1
|
#define FASTFLOAT_ODDPLATFORM 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__cpp_lib_bit_cast)
|
#if HAS_CXX20_CONSTEXPR
|
||||||
#include <bit>
|
#include <bit>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#endif
|
#endif
|
||||||
@ -116,7 +115,7 @@ TEST_CASE("supplemental") {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__cpp_lib_bit_cast)
|
#if HAS_CXX20_CONSTEXPR
|
||||||
|
|
||||||
constexpr double tryParse(std::string_view input)
|
constexpr double tryParse(std::string_view input)
|
||||||
{
|
{
|
||||||
@ -136,7 +135,7 @@ static_assert(tryParse("3.14156") != 3.1415600000001);
|
|||||||
static_assert(std::isnan(tryParse("hellothere"))); // technically isnan is not constexpr but GCC and clang allow it
|
static_assert(std::isnan(tryParse("hellothere"))); // technically isnan is not constexpr but GCC and clang allow it
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif //#if defined(__cpp_lib_bit_cast)
|
#endif //#if HAS_CXX20_CONSTEXPR
|
||||||
|
|
||||||
TEST_CASE("leading_zeroes") {
|
TEST_CASE("leading_zeroes") {
|
||||||
constexpr const uint64_t bit = 1;
|
constexpr const uint64_t bit = 1;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user