Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warning C26818 about switch statements needing default cases #4715

Merged
merged 9 commits into from
Jun 18, 2024
Prev Previous commit
Next Next commit
Fix chrono::parse warning, add test coverage.
This is covered by the new test.

The empty `default: break;` is used, i.e. making it `abort()` causes tests to fail.
  • Loading branch information
StephanTLavavej committed Jun 8, 2024
commit 0b293a07177bf6f5f5e10de3eb1906511fa25a77
2 changes: 2 additions & 0 deletions stl/inc/chrono
Original file line number Diff line number Diff line change
Expand Up @@ -4177,6 +4177,8 @@ namespace chrono {
case '+':
++_First;
break;
default:
break;
}

// For a regular offset hh[mm], simply read four digits, with the option of an EOF or non-digit after
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@

using namespace std;

#if _HAS_CXX20
void instantiate_chrono_parse_machinery() {
istringstream iss{"10:02:07"};
chrono::seconds s{};
iss >> chrono::parse("%H:%M:%S", s);
assert(s == 36127s);
}
#endif // ^^^ _HAS_CXX20 ^^^

#if _HAS_CXX23
template <class T>
struct WrappedVector : vector<T> {
Expand Down