http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59427

            Bug ID: 59427
           Summary: Opening with ios::in | ios::app does not allow
                    appending
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org

#include <cstdlib>
#include <fstream>

int main ()
{
  typedef ::std ::filebuf filebuf;
  typedef filebuf :: traits_type traits; typedef ::std ::ios_base ios;
  filebuf a_f;
  return ! a_f .open  ("/dev/null", ios ::in | ios ::app) 
      || traits ::eq_int_type (traits ::eof (), a_f .sputc (0))
      || ! a_f .close () ? EXIT_FAILURE : EXIT_SUCCESS;
}

fails as std::basic_streambuf<char, std::char_traits<char> >::sputc(char)
falls to the overflow case.

Reply via email to