In an Xcode 14 project that has the C++ language set to C++20 and deployment target set to macOS 10.14, this code:
#include <charconv>
static void foo()
{
if (__builtin_available( macOS 10.15, *))
{
char buffer[10];
std::to_chars_result tcr = std::to_chars( buffer, buffer+5, 5 );
}
}
produces an error message:
'to_chars<int, 0>' is unavailable: introduced in macOS 10.15
(The code does compile if the deployment target is set to 10.15.) I thought the __builtin_available check was supposed to allow me to use functions introduced in macOS 10.15. Why isn't that working?