[libcxx-commits] [PATCH] D122092: [libc++] `bitset::operator[] const` should return bool
Richard Smith - zygoloid via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Apr 14 11:07:26 PDT 2022
rsmith added a comment.
In D122092#3452383 <https://reviews.llvm.org/D122092#3452383>, @rsmith wrote:
> Is it intentional that this leaves `std::vector<bool>::const_iterator::reference` as the class type? We're seeing some breakage in `absl` due to that.
FWIW, the broken code looks roughly like this:
struct NumberLike {
// ...
template<typename T> NumberLike(T) requires std::is_arithmetic_v<T>;
NumberLike(std::vector<bool>::reference);
NumberLike(std::vector<bool>::const_reference);
}
void Consume(NumberLike);
template<typename Container>
void ConsumeAll(const Container &c) {
for (const auto &v : c) Consume(v);
}
This works if `vector<bool>::const_reference` and `vector<bool>::const_iterator::reference` are the same type, but if the iterator produces the class type but `vector<bool>::const_reference` is simply `bool` then the `Consume` call fails.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122092/new/
https://reviews.llvm.org/D122092
More information about the libcxx-commits
mailing list