Improve range check on year

* The previous fix broke parsing of sub-date quantities such as
  durations.
This commit is contained in:
Howard Hinnant
2017-11-30 12:06:51 -05:00
parent 1902b8e8fb
commit 443a29df53

View File

@@ -6997,7 +6997,7 @@ from_stream(std::basic_istream<CharT, Traits>& is, const CharT* fmt,
goto broken;
}
if (Y < static_cast<int>(year::min()) || Y > static_cast<int>(year::max()))
goto broken;
Y = not_a_year;
auto ymd = year{Y}/m/d;
if (wd != not_a_weekday && ymd.ok())
{