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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2018-04-11
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Created attachment 43909
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43909&action=edit
Patch to overload __throw_ios_failure

This patch is probably the best we can do. In theory we could capture errno as
soon as an error occurs and stash it somewhere in ios_base for later retrieval,
but that would be an ABI break.

With this patch this program:

#include <fstream>
int main()
{
  std::ifstream f(".");
  f.exceptions(std::ios::badbit);
  f.get();
}

Produces the more informative:
basic_filebuf::underflow error reading the file: Is a directory

instead of the generic:
basic_filebuf::underflow error reading the file: iostream error

Reply via email to