fix(Core/Misc): Remove Clang 7 workaround (#10521)

This commit is contained in:
Kitzunu
2022-02-11 04:03:29 +01:00
committed by GitHub
parent e97cd7cdc0
commit 5d8b472ed7
2 changed files with 0 additions and 72 deletions

View File

@@ -46,13 +46,6 @@ int main()
}
" CLANG_HAVE_PROPER_CHARCONV)
if (NOT CLANG_HAVE_PROPER_CHARCONV)
message(STATUS "Clang: Detected from_chars bug for 64-bit integers, workaround enabled")
target_compile_definitions(acore-compile-option-interface
INTERFACE
-DACORE_NEED_CHARCONV_WORKAROUND)
endif()
if(WITH_WARNINGS)
target_compile_options(acore-warning-interface
INTERFACE

View File

@@ -90,71 +90,6 @@ namespace Acore::Impl::StringConvertImpl
}
};
#ifdef ACORE_NEED_CHARCONV_WORKAROUND
/*
If this is defined, std::from_chars will cause linkage errors for 64-bit types.
(This is a bug in clang-7.)
If the clang requirement is bumped to >= clang-8, remove this ifdef block and its
associated check in cmake/compiler/clang/settings.cmake
*/
template <>
struct For<uint64, void>
{
static Optional<uint64> FromString(std::string_view str, int base = 10)
{
if (str.empty())
{
return std::nullopt;
}
try
{
size_t n;
uint64 val = std::stoull(std::string(str), &n, base);
if (n != str.length())
{
return std::nullopt;
}
return val;
}
catch (...) { return std::nullopt; }
}
static std::string ToString(uint64 val)
{
return std::to_string(val);
}
};
template <>
struct For<int64, void>
{
static Optional<int64> FromString(std::string_view str, int base = 10)
{
try
{
if (str.empty())
{
return std::nullopt;
}
size_t n;
int64 val = std::stoll(std::string(str), &n, base);
if (n != str.length())
{
return std::nullopt;
}
return val;
}
catch (...) { return std::nullopt; }
}
static std::string ToString(int64 val)
{
return std::to_string(val);
}
};
#endif
template <>
struct For<bool, void>
{