-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Closed as not planned
Closed as not planned
Copy link
Labels
libc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Description
https://eel.is/c++draft/charconv#from.chars-1 says the signature should be
constexpr from_chars_result from_chars(const char* first, const char* last,
integer-type& value, int base = 10);But is implemented as
llvm-project/libcxx/include/__charconv/from_chars_integral.h
Lines 222 to 233 in fcf341d
| template <typename _Tp, __enable_if_t<is_integral<_Tp>::value, int> = 0> | |
| inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result | |
| from_chars(const char* __first, const char* __last, _Tp& __value) { | |
| return std::__from_chars_atoi(__first, __last, __value); | |
| } | |
| template <typename _Tp, __enable_if_t<is_integral<_Tp>::value, int> = 0> | |
| inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result | |
| from_chars(const char* __first, const char* __last, _Tp& __value, int __base) { | |
| _LIBCPP_ASSERT_UNCATEGORIZED(2 <= __base && __base <= 36, "base not in [2, 36]"); | |
| return std::__from_chars_integral(__first, __last, __value, __base); | |
| } |
I'm not should if there's any legal ways to inspect this. And if the following code is well-formed, it does make a difference.
https://godbolt.org/z/vE95qzhEM
#include <charconv>
static_assert(requires {
static_cast<std::from_chars_result(*)(const char*, const char*, int&)>(std::from_chars);
});In addition, if this code is rejected, should the requires expression cause a hard error, or the code fail due to static_assert failure?
Metadata
Metadata
Assignees
Labels
libc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.