Don't negate toff if we've already failed

This avoids calling `-` on `not_a_offset`, which is set to `minutes::min()`, which is typically the min of `long`. Due to two's complement, calling `-` on this minimum value is undefined behavior.
This commit is contained in:
Davis Vaughan
2025-03-17 10:23:00 -04:00
committed by Howard Hinnant
parent 32ecb2ad24
commit 0b336657b1

View File

@ -7577,7 +7577,7 @@ from_stream(std::basic_istream<CharT, Traits>& is, const CharT* fmt,
}
}
}
if (neg)
if (neg && !is.fail())
toff = -toff;
checked_set(temp_offset, toff, not_a_offset, is);
command = nullptr;