This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Throwing std::ios_base::failure on formatted input with gcc 6.2
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Edward Diener <eldlistmailingz at tropicsoft dot com>
- Cc: gcc-help <gcc-help at gcc dot gnu dot org>
- Date: Wed, 26 Oct 2016 12:48:47 +0100
- Subject: Re: Throwing std::ios_base::failure on formatted input with gcc 6.2
- Authentication-results: sourceware.org; auth=none
- References: <nuq4vs$4c5$1@blaine.gmane.org>
On 26 October 2016 at 12:45, Edward Diener wrote:
> If I have code asuch as:
>
> std::stringstream ss;
> ss.exceptions(std::ios_base::failbit | std::ios_base::badbit);
> char c;
> ss >> c;
>
> I would except an exception of std::ios_base::failure to be thrown yet gcc
> 6.2 is throwing some other exception. Is there a reason for this ?
There are two versions of std::ios::failure, one using the old ABI
(called std::ios_base::failure) and one using the new ABI (called
std::ios_base::[abi:__cxx11]failure).
You're trying to catch the new one, but the library throws the old
one. I'm probably going to change the library to throw the new one for
GCC 7.