diff --git a/libcxx/include/__bit_reference b/libcxx/include/__bit_reference --- a/libcxx/include/__bit_reference +++ b/libcxx/include/__bit_reference @@ -1109,7 +1109,11 @@ typedef typename _Cp::difference_type difference_type; typedef bool value_type; typedef __bit_iterator pointer; +#ifndef _LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL typedef typename conditional<_IsConst, __bit_const_reference<_Cp>, __bit_reference<_Cp> >::type reference; +#else + using reference = typename conditional<_IsConst, bool, __bit_reference<_Cp>>::type; +#endif typedef random_access_iterator_tag iterator_category; private: diff --git a/libcxx/test/std/containers/sequences/vector.bool/iterators.pass.cpp b/libcxx/test/std/containers/sequences/vector.bool/iterators.pass.cpp --- a/libcxx/test/std/containers/sequences/vector.bool/iterators.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector.bool/iterators.pass.cpp @@ -24,6 +24,15 @@ int main(int, char**) { + using IterRefT = std::iterator_traits::iterator>::reference; + ASSERT_SAME_TYPE(IterRefT, std::vector::reference); + + using ConstIterRefT = std::iterator_traits::const_iterator>::reference; +#if !defined(_LIBCPP_VERSION) || defined(_LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL) + ASSERT_SAME_TYPE(ConstIterRefT, bool); +#else + ASSERT_SAME_TYPE(ConstIterRefT, std::__bit_const_reference >); +#endif { typedef bool T; typedef std::vector C;