public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "pluto at agmk dot net" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/52540] New: std::use_facet throws bad_cast when compiled with _GLIBCXX_DEBUG Date: Fri, 09 Mar 2012 10:56:00 -0000 [thread overview] Message-ID: <bug-52540-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52540 Bug #: 52540 Summary: std::use_facet throws bad_cast when compiled with _GLIBCXX_DEBUG Classification: Unclassified Product: gcc Version: 4.6.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: pluto@agmk.net Target: x86_64-w64-mingw32 #include <iostream> #include <locale> #include <cstring> #include <ctime> int main() { std::tm tm; std::time_t tt; std::time( &tt ); tm = *std::localtime( &tt ); std::locale lc( "C" ); std::cout.imbue( lc ); std::time_put< char > const& timeFacet = std::use_facet< std::time_put< char > >( std::cout.getloc() ); char const pattern[] = "%x %X"; timeFacet.put( std::cout, std::cout, std::cout.fill(), &tm, pattern, pattern + std::strlen( pattern ) ); } $ x86_64-w64-mingw32-g++ main.cpp -o main-release.exe -g2 $ x86_64-w64-mingw32-g++ main.cpp -o main-debug.exe -g2 -D_GLIBCXX_DEBUG release-run: Starting program: main-release.exe [New Thread 2776.0xdbc] Breakpoint 1, main () at main.cpp:7 7 { (gdb) n 10 std::time( &tt ); (gdb) 11 tm = *std::localtime( &tt ); (gdb) 12 std::locale lc( "C" ); (gdb) 13 std::cout.imbue( lc ); (gdb) p lc $2 = {static none = 0, static ctype = 1, static numeric = 2, static collate = 4, static time = 8, static monetary = 16, static messages = 32, static all = 63, _M_impl = 0x626e9460, static _S_classic = 0x626e9460, static _S_global = 0x626e9460, static _S_categories = 0x626eadc0, static _S_once = {done = 1, started = 0}} (gdb) c Continuing. 03/09/12 11:53:50 Program exited normally. debug-run: Starting program: main-debug.exe [New Thread 2704.0xd4c] Breakpoint 1, main () at main.cpp:7 7 { (gdb) l 2 #include <locale> 3 #include <cstring> 4 #include <ctime> 5 6 int main() 7 { 8 std::tm tm; 9 std::time_t tt; 10 std::time( &tt ); 11 tm = *std::localtime( &tt ); (gdb) n 10 std::time( &tt ); (gdb) 11 tm = *std::localtime( &tt ); (gdb) 12 std::locale lc( "C" ); (gdb) 13 std::cout.imbue( lc ); (gdb) p lc $1 = {static none = 0, static ctype = 1, static numeric = 2, static collate = 4, static time = 8, static monetary = 16, static messages = 32, static all = 63, _M_impl = 0x626e9460, static _S_classic = 0x626e9460, static _S_global = 0x626e9460, static _S_categories = 0x626eadc0, static _S_once = {done = 1, started = 0}} (gdb) n 14 std::time_put< char > const& timeFacet = std::use_facet< std::time_put< char > >( std::cout.getloc() ); (gdb) terminate called after throwing an instance of 'std::bad_cast' what(): std::bad_cast
next reply other threads:[~2012-03-09 10:56 UTC|newest] Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-03-09 10:56 pluto at agmk dot net [this message] 2012-03-09 11:03 ` [Bug libstdc++/52540] " paolo.carlini at oracle dot com 2012-03-09 11:20 ` ktietz at gcc dot gnu.org 2012-03-09 11:21 ` ktietz at gcc dot gnu.org 2012-03-09 12:00 ` ktietz at gcc dot gnu.org 2012-03-09 12:56 ` paolo.carlini at oracle dot com 2012-03-09 13:01 ` ktietz at gcc dot gnu.org 2012-03-10 13:15 ` pluto at agmk dot net 2012-03-10 13:17 ` pluto at agmk dot net 2012-03-11 11:21 ` paolo.carlini at oracle dot com 2012-03-11 18:36 ` ktietz at gcc dot gnu.org 2012-03-11 19:50 ` pluto at agmk dot net 2012-03-15 16:23 ` pluto at agmk dot net 2012-03-15 16:37 ` pluto at agmk dot net 2012-03-16 10:12 ` paolo.carlini at oracle dot com 2012-03-16 10:40 ` pluto at agmk dot net 2012-03-19 23:59 ` paolo at gcc dot gnu.org 2012-03-23 11:09 ` paolo at gcc dot gnu.org 2012-03-23 11:33 ` paolo.carlini at oracle dot com
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-52540-4@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).