[Bug libstdc++/85343] New: Overload __throw_ios_failure to allow passing errno

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Apr 11 11:51:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85343

            Bug ID: 85343
           Summary: Overload __throw_ios_failure to allow passing errno
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

The standard says "When throwing ios_base::failure exceptions, implementations
should provide values of ec that identify the specific reason for the failure."

We currently always use an error_code containing io_errc::stream.

We can probably only expect errno to be set for filebuf operations, and in
practice only for failed reads. Failed writes from basic_filebuf::overflow
return -1 which might cause a stream object to set failbit and then throw, but
at that point we're too far away from the write to know if errno can be relied
on or not.


More information about the Gcc-bugs mailing list