GreenDragon
MCVE([online-compiler](https://ideone.com/kxBgQN)):
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <sstream>
#include <chrono>
int main()
{
std::tm date{};
std::istringstream ss("2021-05-1");
ss >> std::get_time(&date, "%Y-%m-%d");
std::cout << std::boolalpha << ss.fail() << '\n';
}
Output:
> true
On VS compiler output is:
> false
[Cppreference](https://en.cppreference.com/w/cpp/io/manip/get_time) is saying that leading zeros are not requiring, is it bug in gcc or something else?
Top Answer
GreenDragon
It's indeed an old bug in gcc - [Facet time_get not reading dates according to the IEEE 1003 standard](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45896).