This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/52540] std::use_facet throws bad_cast when compiled with _GLIBCXX_DEBUG


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52540

--- Comment #4 from Kai Tietz <ktietz at gcc dot gnu.org> 2012-03-09 12:00:00 UTC ---
Issue happens in
include/bits/locale_classes.tcc:

      template<typename _Facet>
        const _Facet&
        use_facet(const locale& __loc)
        {
          const size_t __i = _Facet::id._M_id();
          const locale::facet** __facets = __loc._M_impl->_M_facets;
134        if (__i >= __loc._M_impl->_M_facets_size || !__facets[__i])
135         __throw_bad_cast();
   #ifdef __GXX_RTTI
         return dynamic_cast<const _Facet&>(*__facets[__i]);
   #else
         return static_cast<const _Facet&>(*__facets[__i]);
   #endif
       }

The variable __i has value 30, but __loc.M_impl->_M_factes_size is just 28.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]