https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81964
--- Comment #3 from Petr Ovtchenkov <abominable-snowman at yandex dot ru> --- Looks "not a bug". Standard say (with a bit misoriented words): 27.6.1 Class template istream_iterator [istream.iterator] 1 The class template istream_iterator is an input iterator (27.2.3) that reads (using operator>>) successive elements from the input stream for which it was constructed. -> After it is constructed, and every time ++ is used, the iterator -> reads and stores a value of T. ... 27.6.1.1 istream_iterator constructors and destructor [istream.iterator.cons] ... istream_iterator(istream_type& s); -> 3 Effects: Initializes in_stream with addressof(s). value may be initialized -> during construction or the first time it is referenced. 4 Postconditions: in_stream == addressof(s). Current position is "After it is constructed ... the iterator reads and stores a value of T.": http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0738r0.html