This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/69877] New: Problem with std::basic_ios::setstate()
- From: "lcarreon at bigpond dot net.au" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 19 Feb 2016 19:32:19 +0000
- Subject: [Bug libstdc++/69877] New: Problem with std::basic_ios::setstate()
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69877
Bug ID: 69877
Summary: Problem with std::basic_ios::setstate()
Product: gcc
Version: 5.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: lcarreon at bigpond dot net.au
Target Milestone: ---
I created the following simple test program:
#include <sstream>
#include <iostream>
int main()
{
std::ostringstream vStream;
vStream.exceptions(std::ios_base::badbit);
vStream.setstate(std::ios_base::badbit);
return 0;
}
I then compiled and linked it on 64-bit Fedora 23 using the following commands:
g++ -ansi -c -g -m64 -o sample.o -Wall -Werror -std=c++14 sample.cpp
g++ -g -m64 -o sample sample.o
When I execute the resulting executable, it generates the following output:
terminate called after throwing an instance of 'std::ios_base::failure'
what(): basic_ios::clear
./sample.sh: line 3: 3397 Aborted (core dumped) ./sample
Please notice that the executable core dumped. Even if I try to catch the
exception, it still core dumps. If I remember correctly, this did not happen
on Fedora 22 which included g++ 5.1.1.
Do you have an idea why this is happening? The above problem is causing my
user defined type's stream insertion/extraction operators to fail.