This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/22131] New: std::num_get fails for input with invalid groups
- From: "sebor at roguewave dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Jun 2005 23:48:16 -0000
- Subject: [Bug libstdc++/22131] New: std::num_get fails for input with invalid groups
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The program below is expected to run successfully to completion but when
compiled with gcc 3.4.3 or 4.0.0 it aborts.
$ cat u.cpp && g++ u.cpp && ./a.out
#include <locale>
#include <sstream>
#include <cassert>
int main ()
{
struct Punct: std::numpunct<char> {
std::string do_grouping () const { return "\1"; }
char do_thousands_sep () const { return '#'; }
};
std::istringstream strm ("00#0#1");
strm.imbue (std::locale (strm.getloc (), (std::numpunct<char>*)new Punct));
int x = 0;
strm >> x;
assert (1 == x);
assert ((strm.eofbit | strm.failbit) == strm.rdstate ());
}
Assertion failed: 1 == x, file u.cpp, line 18
Abort (core dumped)
--
Summary: std::num_get fails for input with invalid groups
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sebor at roguewave dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22131