diff --git a/libcxx/include/__bit_reference b/libcxx/include/__bit_reference --- a/libcxx/include/__bit_reference +++ b/libcxx/include/__bit_reference @@ -154,6 +154,8 @@ friend typename _Cp::__self; friend class __bit_iterator<_Cp, true>; public: + using __container = typename _Cp::__self; + _LIBCPP_INLINE_VISIBILITY __bit_const_reference(const __bit_const_reference&) = default; diff --git a/libcxx/test/std/containers/container.adaptors/container.adaptors.format/format.functions.tests.h b/libcxx/test/std/containers/container.adaptors/container.adaptors.format/format.functions.tests.h --- a/libcxx/test/std/containers/container.adaptors/container.adaptors.format/format.functions.tests.h +++ b/libcxx/test/std/containers/container.adaptors/container.adaptors.format/format.functions.tests.h @@ -399,8 +399,7 @@ void test_bool(TestFunction check, ExceptionTest check_exception) { std::array input{true, true, false}; test_bool(check, check_exception, std::queue{input.begin(), input.end()}); - // TODO FMT Use std::vector after it has been implemented. - test_bool(check, check_exception, std::priority_queue>{input.begin(), input.end()}); + test_bool(check, check_exception, std::priority_queue{input.begin(), input.end()}); test_bool(check, check_exception, std::stack{input.begin(), input.end()}); } diff --git a/libcxx/test/std/containers/sequences/vector.bool/vector.bool.fmt/format.functions.tests.h b/libcxx/test/std/containers/sequences/vector.bool/vector.bool.fmt/format.functions.tests.h --- a/libcxx/test/std/containers/sequences/vector.bool/vector.bool.fmt/format.functions.tests.h +++ b/libcxx/test/std/containers/sequences/vector.bool/vector.bool.fmt/format.functions.tests.h @@ -14,9 +14,7 @@ #include "test_macros.h" template -void format_tests(TestFunction check, ExceptionTest check_exception) { - std::vector input{true, true, false}; - +void format_test_vector_bool(TestFunction check, ExceptionTest check_exception, auto&& input) { check(SV("[true, true, false]"), SV("{}"), input); // ***** underlying has no format-spec @@ -113,4 +111,15 @@ check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 32); } +template +void format_tests(TestFunction check, ExceptionTest check_exception) { + format_test_vector_bool(check, check_exception, std::vector{true, true, false}); + + // The const_reference shall be a bool. + // However libc++ uses a __bit_const_reference when + // _LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL is defined. + const std::vector input{true, true, false}; + format_test_vector_bool(check, check_exception, input); +} + #endif // TEST_STD_CONTAINERS_SEQUENCES_VECTOR_BOOL_VECTOR_BOOL_FMT_FORMAT_FUNCTIONS_TESTS_H diff --git a/libcxx/test/std/utilities/format/format.formattable/concept.formattable.compile.pass.cpp b/libcxx/test/std/utilities/format/format.formattable/concept.formattable.compile.pass.cpp --- a/libcxx/test/std/utilities/format/format.formattable/concept.formattable.compile.pass.cpp +++ b/libcxx/test/std/utilities/format/format.formattable/concept.formattable.compile.pass.cpp @@ -199,6 +199,12 @@ void test_P2286_vector_bool() { assert_is_formattable(); assert_is_formattable(); + + // The const_reference shall be a bool. + // However libc++ uses a __bit_const_reference when + // _LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL is defined. + assert_is_formattable(); + assert_is_formattable(); } // Tests for P2286 Formatting ranges