------- Comment #1 from sebor at roguewave dot com 2007-12-13 05:41 ------- FWIW, it looks like you need a dynamic_cast in use_facet (it's not enough to check the id and then downcast using static_cast). Something like this:
--- locale_facets.tcc 2007-10-21 08:33:43.000000000 -0600 +++ locale_facets.tcc 2007-12-12 22:28:07.000000000 -0700 @@ -111,9 +111,13 @@ { const size_t __i = _Facet::id._M_id(); const locale::facet** __facets = __loc._M_impl->_M_facets; + + const locale::facet* __pf; if (!(__i < __loc._M_impl->_M_facets_size && __facets[__i])) - __throw_bad_cast(); - return static_cast<const _Facet&>(*__facets[__i]); + __pf = 0; + else + __pf = __facets[__i]; + return dynamic_cast<const _Facet&>(*__pf); } // Routine to access a cache for the facet. If the cache didn't -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34449