From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6048 invoked by alias); 11 Mar 2012 19:50:31 -0000 Received: (qmail 6037 invoked by uid 22791); 11 Mar 2012 19:50:30 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_GM X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 11 Mar 2012 19:50:14 +0000 From: "pluto at agmk dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/52540] std::use_facet throws bad_cast when compiled with _GLIBCXX_DEBUG Date: Sun, 11 Mar 2012 19:50:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pluto at agmk dot net X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-03/txt/msg00813.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52540 --- Comment #11 from Pawel Sikora 2012-03-11 19:49:41 UTC --- (In reply to comment #9) > Then this is a very old issue, isn't it? Why nobody noticed it before? To be > clear, in debug-mode we don't use extern templates only for basic_string > (because _GLIBCXX_EXTERN_TEMPLATE becomes -1 when _GLIBCXX_DEBUG is defined), > all the other facilities remain the same still use extern tamplate. This is in > order to enable debug-mode checks also at -O0 for basic_string. Now, I don't > see why a few less extern template can make a difference on mingw in terms of > correctness of use_facet or anything else, but if that's really the case due to > fundamental limitations somehwhere, we can trade it for the -O0 basic_string > checks on the affected systems, I have no problems with that (note that, > AFAICS, the problem will not go away with a new C++11 conforming string class, > unless we decide to not export from the .so parts of basic_string) i'm not sure the problem is in std::string details. in the debug-mode the use_facet is no more extern template and instantiates in client code, especially the static facet's field like std::locale::id. is this 'id' and other static details correctly initialized in (non-extern-template) debug-mode?