public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "sebor at roguewave dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/28103] New: std::operator<<(ostream&, string) sets badbit instead of failbit on failure Date: Tue, 20 Jun 2006 18:21:00 -0000 [thread overview] Message-ID: <bug-28103-1186@http.gcc.gnu.org/bugzilla/> (raw) 21.3.7.9, p4 requires the operator to set failbit, not badbit, on failure. This came up while I was gathering background for c++std-lib-17241. $ cat ~/tmp/t.cpp && g++ ~/tmp/t.cpp -static && ./a.out #include <cassert> #include <cstdio> #include <string> #include <strstream> int main () { char buf [3]; std::ostrstream os (buf, sizeof (buf)); os << std::string ("1234"); std::printf ("state = %c%c%c (expected --?)\n", os.rdstate () & os.badbit ? 'B' : '-', os.rdstate () & os.eofbit ? 'E' : '-', os.rdstate () & os.failbit ? 'F' : '-'); std::fflush (stdout); assert (!(os.rdstate () & os.badbit)); } In file included from /usr/local/gcc-4.1.0/lib/gcc/sparc-sun-solaris2.9/4.1.0/../../../../include/c++/4.1.0/backward/strstream:51, from /nfs/b20/sebor/tmp/t.cpp:4: /usr/local/gcc-4.1.0/lib/gcc/sparc-sun-solaris2.9/4.1.0/../../../../include/c++/4.1.0/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated. state = B-- (expected --?) Assertion failed: !(os.rdstate () & os.badbit), file /nfs/b20/sebor/tmp/t.cpp, line 21 Abort (core dumped) -- Summary: std::operator<<(ostream&, string) sets badbit instead of failbit on failure Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: sebor at roguewave dot com GCC build triplet: all GCC host triplet: all GCC target triplet: all http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28103
next reply other threads:[~2006-06-20 18:14 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2006-06-20 18:21 sebor at roguewave dot com [this message] 2006-06-20 19:09 ` [Bug libstdc++/28103] " pcarlini at suse dot de 2006-06-22 16:28 ` pcarlini at suse dot de
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-28103-1186@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).