https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103755

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Dmitry Prokoptsev from comment #6)
> That would also work, I suppose (it even outperforms my original approach by
> a tiny bit -- 33 ns for v2 vs 36 for my original implementation).
> 
> There are a few build errors in the alternative implementations, however:
> is_convertible<locale::facet*, _Facet*>::value is false, as it tries to
> downcast the facet -- did you mean is_base_of<>, which would also better
> align with the static assert message?

Yes, I've already changed it to use that in my local branch.

> Also, despite the always_inline attribute of __try_use_facet, my attempts to
> build the library with -O0 -ggdb and link my benchmark yielded a bunch of
> errors like 
> 
>     ld:
> /home/av/prgs/gcc/debug/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.
> so: undefined reference to `std::num_get<char,
> std::istreambuf_iterator<char, std::char_traits<char> > > const*
> std::__try_use_facet<std::num_get<char, std::istreambuf_iterator<char,
> std::char_traits<char> > > >(std::locale const&)'

Yes, that's what happens for the debug libs built with --enable-libstdcxx-debug 

> Suggest explicitly instantiating __try_use_facet where has_facet() and
> use_facet() is instantiated.

Yes, I wanted to avoid that :-(

> See attached fix for build problems I discovered.

Thanks, I'll compare it with the fixes I've already got locally and finish
retesting.

Reply via email to