------- Comment #5 from sebor at roguewave dot com 2006-02-09 17:29 ------- Here's my analysis copied from the post on the Sun C++ Forum.
According to 27.6.1.3, p36a, tellg() behaves as an unformatted input function (as described in 27.6.1.3, p1). >From 27.6.1.3, p1: Each unformatted input function begins execution by constructing an object of class sentry with the default argument noskipws (second) argument true. If the sentry object returns true, when converted to a value of type bool, the function endeavors to obtain the requested input. Since eofbit is set prior to calling tellg() the function must not "endeavor to obtain the requested input." Hence it must fail. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26181