"boost asio address::from_string" invalid argument on "localhost"

Does anybody know why this gives "Invalid argument" error..

boost::asio::ip::tcp::endpoint ep(address::from_string("localhost"), 8000);

but below works fine

boost::asio::ip::tcp::endpoint ep(address::from_string("127.0.0.1"), 8000);

I'm using boost 1.67.0