[PATCH] D55427: [libcxx] Use specialized helper for __bit_reference count

Adhemerval Zanella via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 10 05:28:37 PST 2018


zatrazz added a comment.

In D55427#1323715 <https://reviews.llvm.org/D55427#1323715>, @mclow.lists wrote:

> In D55427#1323656 <https://reviews.llvm.org/D55427#1323656>, @mclow.lists wrote:
>
> > This looks like a behavior change to me.
> >  The old code calls `__count_bool_true` if the `_Tp` can be `static_cast` to `bool`, and `__count_bool_false` otherwise.
> >  The new code calls `__count_bool_true` if the `_Tp` is exactly `bool`, and `__count_bool_false` otherwise.
>
>
> Sorry; the old code calls `__count_bool_true` if the `static_cast<bool>(value)` is true, and `__count_bool_false` otherwise.


You are correct, this change breaks std::vector<bool> with std::count. What about calling __count_bool_true direct on std::bitset 
to avoid having to pass with bool type? For std::count I think we will need to fix it on clang inliner (my initial plan).


Repository:
  rCXX libc++

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55427/new/

https://reviews.llvm.org/D55427





More information about the llvm-commits mailing list