diff --git a/src/tz.cpp b/src/tz.cpp index fd7e97a..5f44adb 100644 --- a/src/tz.cpp +++ b/src/tz.cpp @@ -93,6 +93,7 @@ #include #include #include +#include #include #include #include @@ -918,6 +919,8 @@ detail::operator>>(std::istream& is, MonthDayTime& x) { using namespace date; using namespace std::chrono; + assert(((std::ios::failbit | std::ios::badbit) & is.exceptions()) == + (std::ios::failbit | std::ios::badbit)); x = MonthDayTime{}; if (!is.eof() && ws(is) && !is.eof() && is.peek() != '#') { @@ -935,11 +938,11 @@ detail::operator>>(std::istream& is, MonthDayTime& x) else if (std::isalpha(is.peek())) { auto dow = parse_dow(is); - char c; + char c{}; is >> c; if (c == '<' || c == '>') { - char c2; + char c2{}; is >> c2; if (c2 != '=') throw std::runtime_error(std::string("bad operator: ") + c + c2); @@ -1398,7 +1401,7 @@ find_previous_rule(const Rule* r, date::year y) if (y == r->starting_year()) { if (r == &rules.front() || r->name() != r[-1].name()) - return {nullptr, year::min()}; + std::terminate(); // never called with first rule --r; if (y == r->starting_year()) return {r, y};