I have a small code as follows:
int main() {
double d;
const char* str = "26.50";
std::from_chars(str, str + strlen(str), d);
std::cout << d;
}
This code works as expected with libstdc++, but it fails with the following error in libc++ 12.0.0:
candidate template ignored: requirement '__or_<std::__or_<std::is_same<double, signed char>, std::is_same<double, short>, std::is_same<double, int>, std::is_same<double, long>, std::is_same<double, long long>>, std::__or_<std::is_same<double, unsigned char>, std::is_same<double, unsigned short>, std::is_same<double, unsigned int>, std::is_same<double, unsigned long>, std::is_same<double, unsigned long long>>, std::is_same<char, double>>::value' was not satisfied [with _Tp = double]
Is this a libc++ bug? or am I missing something? I should say that this code works if I change data type from double
to int
.