<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:mclow.lists@gmail.com" title="Marshall Clow (home) <mclow.lists@gmail.com>"> <span class="fn">Marshall Clow (home)</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - std::ws sets failbit at eof"
   href="http://llvm.org/bugs/show_bug.cgi?id=19497">bug 19497</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>INVALID
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - std::ws sets failbit at eof"
   href="http://llvm.org/bugs/show_bug.cgi?id=19497#c1">Comment # 1</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - std::ws sets failbit at eof"
   href="http://llvm.org/bugs/show_bug.cgi?id=19497">bug 19497</a>
              from <span class="vcard"><a class="email" href="mailto:mclow.lists@gmail.com" title="Marshall Clow (home) <mclow.lists@gmail.com>"> <span class="fn">Marshall Clow (home)</span></a>
</span></b>
        <pre>I responded on the SO question, and I'll repeat it here.

I believe that libc++'s behavior is correct per the standard.

[istream.manip] states (about ws):

Effects: Behaves as an unformatted input function (as described in 27.7.2.3,
paragraph 1), except that it does not count the number of characters extracted
and does not affect the value returned by subsequent calls to is.gcount().
After constructing a sentry object extracts characters as long as the next
available character c is whitespace or until there are no more characters in
the sequence. Whitespace characters are distinguished with the same criterion
as used by sentry::sentry (27.7.2.1.3). If ws stops extracting characters
because there are no more available it sets eofbit, but not fail bit.

and 

[istream::sentry]/2 says (about the constructor of the sentry):
2 Effects: If is.good() is false, calls is.setstate(failbit). Otherwise,
prepares for formatted or > unformatted input. ...and so on…

It seems to me that you can argue that libstdc++'s behavior is reasonable, i.e,
if no characters need to be extracted (since we're at EOF), then there's no
reason to set the fail bit. I've opened an issue with the standards committee
asking for clarification. 

I also answered on StackOverflow, too.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>