Closed Flamefire closed 7 months ago
It looks like the virtual function dispatch gets messed up in your use case as indicated by __cxxabiv1::__si_class_type_info
in the call stack which doesn't look right.
The actual type of boost::locale::collator<char>
, i.e. of *this
inside the compare
call is likely one from boost::locale::impl_std
or boost::locale::impl_posix
. And those only derive from std::collate
but not from boost::locale::collate
which means they do not implement that do_compare
function taking a level
argument. And seemingly std::use_facet
does not check the actual type but only the id (on OSX/libc++).
In particular only the WinAPI and the ICU backends implement that facet and you don't even have either build which explains this.
So in a semi-correct version your use of std::use_facet<boost::locale::collator<char>>
should throw a std::bad_cast
. At least until the Posix and Std backends implement that facet which I don't think is possible.
However, when I try to use it, this snippet crashes the application:
In the file:
collator.hpp
- see the screenshots from Xcode debugger.Originally posted by @olekrisek in https://github.com/boostorg/locale/issues/210#issuecomment-1876819426