Presumably, the istream iterator immediately calls cin >> x to extract the first token and determine if it should become equal to the end iterator. The extraction operation blocks until the stream is closed, the token is retrieved, or a parsing failure is detected.
Please note that the name of the question is incorrect: you not only declared input , but also defined it. If your code accurately reflected the question, it would say
extern istream_iterator<char> input;
and there will be no blockage.
source share