failbit not being set when seekg seeks past end of file (C++,Linux)
<p>I'm seeing what I think is odd behaviour of istream::seekg.  Specifically, it appears to
NOT set the failbit when I seek to a point that is clearly way off the end of the file.</p>

<p>From what I can tell in the documentation, the failbit should be set, yet it is not.  </p>

<p>Can anyone explain this behaviour?  snippet of relevant code:</p>

<pre><code>class Tester 
{

  ... 

  void testTriggered()
  {
    fs.open("/pathtofile/testFile.TEST", std::ios_base::in|std::ios_base::binary);
    prv_testbits("testTriggered(): OpeningFile");

    fs.seekg(2000,std::ios_base::beg);
    prv_testbits("testTriggered(): seekTwoThousand");
    int g = fs.tellg();
    std::cout &lt;&lt; "get pointer is:" &lt;&lt; g &lt;&lt; std::endl; 
  }

  void prv_testbits(std::string msg){
    if (fs.fail()) {
      std::cout &lt;&lt; msg &lt;&lt; ": failbit set." &lt;&lt; std::endl;
    } else {
      std::cout &lt;&lt; msg &lt;&lt; ": failbit NOT set." &lt;&lt; std::endl;
    }
    if (fs.bad()) {
      std::cout &lt;&lt; msg &lt;&lt; ": badbit set." &lt;&lt; std::endl;
    }else {
      std::cout &lt;&lt; msg &lt;&lt; ": badbit NOT set." &lt;&lt; std::endl;
    }
    if (fs.eof()) {
      std::cout &lt;&lt; msg &lt;&lt; ": eofbit set." &lt;&lt; std::endl;
    } else {
      std::cout &lt;&lt; msg &lt;&lt; ": eofbit NOT set." &lt;&lt; std::endl;
    }
  }

   ....

 private:
  std::ifstream fs;
}; 
</code></pre>

<p>input file consists of twenty bytes:
    0123456789abcdefghij</p>

<p>output of sample run:</p>

<pre><code>testTriggered(): OpeningFile: failbit NOT set.
testTriggered(): OpeningFile: badbit NOT set.
testTriggered(): OpeningFile: eofbit NOT set.
testTriggered(): seekTwoThousand: failbit NOT set.
testTriggered(): seekTwoThousand: badbit NOT set.
testTriggered(): seekTwoThousand: eofbit NOT set.
get pointer is:2000
</code></pre>

<p>g++ version info:
$ g++ -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5' -with-gxx-include-dir=/usr/include/c++/4.4 [snip]
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)</p>

<p>$ uname -a
Linux hostx 2.6.32-36-server #79-Ubuntu SMP Tue Nov 8 22:44:38 UTC 2011 x86_64 GNU/Linux</p>
