mirror of
https://github.com/fastfloat/fast_float.git
synced 2026-01-01 03:12:18 +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)
|
||||
#undef CXX20_CONSTEXPR
|
||||
#define CXX20_CONSTEXPR constexpr
|
||||
#define HAS_CXX20_CONSTEXPR 1
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -81,6 +81,7 @@
|
||||
#if defined(__cpp_lib_bit_cast)
|
||||
#undef CXX20_CONSTEXPR
|
||||
#define CXX20_CONSTEXPR constexpr
|
||||
#define HAS_CXX20_CONSTEXPR 1
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
#include "fast_float/fast_float.h"
|
||||
#include <iomanip>
|
||||
#include <string>
|
||||
#include <version>
|
||||
|
||||
#ifndef SUPPLEMENTAL_TEST_DATA_DIR
|
||||
#define SUPPLEMENTAL_TEST_DATA_DIR "data/"
|
||||
@ -38,7 +37,7 @@
|
||||
#define FASTFLOAT_ODDPLATFORM 1
|
||||
#endif
|
||||
|
||||
#if defined(__cpp_lib_bit_cast)
|
||||
#if HAS_CXX20_CONSTEXPR
|
||||
#include <bit>
|
||||
#include <string_view>
|
||||
#endif
|
||||
@ -116,7 +115,7 @@ TEST_CASE("supplemental") {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__cpp_lib_bit_cast)
|
||||
#if HAS_CXX20_CONSTEXPR
|
||||
|
||||
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
|
||||
#endif
|
||||
|
||||
#endif //#if defined(__cpp_lib_bit_cast)
|
||||
#endif //#if HAS_CXX20_CONSTEXPR
|
||||
|
||||
TEST_CASE("leading_zeroes") {
|
||||
constexpr const uint64_t bit = 1;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user