I'm trying to understand what should be the correct behavior of C++11
std::get\_time() when the input data is "shorter" than expected by the format
string. For example, what the following program should print:

```
#include <ctime>
#include <iomanip>
#include <sstream>
#include <iostream>

int main (int argc, char* argv[])
{
  using namespace std;

  tm t {};
  istringstream is ("2016");
  is >> get_time (&t, "%Y %d");

  cout << "eof:  " << is.eof ()  << endl
       << "fail: " << is.fail () << endl;
}

```

Note that [get\_time()](https://en.cppreference.com/w/cpp/io/manip/get_time)
behavior is described in terms of
[std::time\_get<CharT,InputIt>::get()](https://en.cppreference.com/w/cpp/locale/time_get/get).
Based on the latter (see 1c paragraph) I would expect both eofbit and failbit
to be set and so the program to print:

```
eof:  1
fail: 1

```

However, for all the major Standard C++ Library implementations (libstdc++
10.2.1, libc++ 11.0.0, and MSVC 16.8) it prints:

```
eof:  1
fail: 0

```

Interestingly, that for MSVC before 16.8 it prints:

```
eof:  1
fail: 1

```

But the commit ["std::get\_time should not fail when format is longer than the stream"](https://github.com/microsoft/STL/commit/740288374fc1c282a3c1f7facd3c2c4a557960b4)
suggests that this was fixed deliberately.

Could someone clarify if (and why) the mentioned standard libraries behave correctly and, if that's the case, how it is supposed to detect that the format string was not fully used.