The point is that fail flag is also being set when eof situation happens!
I used g++ (Gentoo 4.5.3-r2 p1.1, pie-0.4.7) 4.5.3
I'm just frustrated, i don't believe that this is plainly bug of g++, or that documentation on cplusplus.com became incorrect... But also i don't see error from my side.
Any comments?
Each I/O operation has its own requirements for setting the stream status bits. istream::read(), in particular, sets both eofbit and failbit if it fails to read due to the end-of-file condition.