diff --git a/libcxx/include/__format/formatter_bool.h b/libcxx/include/__format/formatter_bool.h --- a/libcxx/include/__format/formatter_bool.h +++ b/libcxx/include/__format/formatter_bool.h @@ -54,10 +54,6 @@ this->__handle_bool(); break; - case _Flags::_Type::__char: - this->__handle_char(); - break; - case _Flags::_Type::__binary_lower_case: case _Flags::_Type::__binary_upper_case: case _Flags::_Type::__octal: diff --git a/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_bool.pass.cpp b/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_bool.pass.cpp --- a/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_bool.pass.cpp +++ b/libcxx/test/libcxx/utilities/format/format.string/format.string.std/std_format_spec_bool.pass.cpp @@ -196,76 +196,6 @@ test({.locale_specific_form = true}, 2, CSTR("Ls}")); } -template -constexpr void test_as_char() { - - test({.type = _Flags::_Type::__char}, 1, CSTR("c}")); - - // *** Align-fill *** - test({.alignment = _Flags::_Alignment::__left, .type = _Flags::_Type::__char}, - 2, CSTR("c}"); - - test({.fill = CharT('L'), - .alignment = _Flags::_Alignment::__left, - .type = _Flags::_Type::__char}, - 3, CSTR("Lc}")); - - // *** Sign *** - test_exception>( - "A sign field isn't allowed in this format-spec", CSTR("-c}")); - - // *** Alternate form *** - test_exception>( - "An alternate form field isn't allowed in this format-spec", CSTR("#c}")); - - // *** Zero padding *** - test_exception>( - "A zero-padding field isn't allowed in this format-spec", CSTR("0c}")); - - // *** Width *** - test({.width = 0, .width_as_arg = false, .type = _Flags::_Type::__char}, 1, - CSTR("c}")); - test({.width = 1, .width_as_arg = false, .type = _Flags::_Type::__char}, 2, - CSTR("1c}")); - test({.width = 10, .width_as_arg = false, .type = _Flags::_Type::__char}, 3, - CSTR("10c}")); - test({.width = 1000, .width_as_arg = false, .type = _Flags::_Type::__char}, 5, - CSTR("1000c}")); - test({.width = 1000000, .width_as_arg = false, .type = _Flags::_Type::__char}, - 8, CSTR("1000000c}")); - - test({.width = 0, .width_as_arg = true, .type = _Flags::_Type::__char}, 3, - CSTR("{}c}")); - test({.width = 0, .width_as_arg = true, .type = _Flags::_Type::__char}, 4, - CSTR("{0}c}")); - test({.width = 1, .width_as_arg = true, .type = _Flags::_Type::__char}, 4, - CSTR("{1}c}")); - - // *** Precision *** - test_exception>( - "The format-spec should consume the input or end with a '}'", CSTR(".")); - test_exception>( - "The format-spec should consume the input or end with a '}'", CSTR(".1")); - - // *** Locale-specific form *** - test({.locale_specific_form = true, .type = _Flags::_Type::__char}, 2, - CSTR("Lc}")); -} - template constexpr void test_as_integer() { @@ -401,7 +331,6 @@ test({}, 0, CSTR("}")); test_as_string(); - test_as_char(); test_as_integer(); // *** Type *** @@ -413,6 +342,7 @@ test_exception>(expected, CSTR("F}")); test_exception>(expected, CSTR("G}")); test_exception>(expected, CSTR("a}")); + test_exception>(expected, CSTR("c}")); test_exception>(expected, CSTR("e}")); test_exception>(expected, CSTR("f}")); test_exception>(expected, CSTR("g}")); diff --git a/libcxx/test/std/utilities/format/format.functions/format_tests.h b/libcxx/test/std/utilities/format/format.functions/format_tests.h --- a/libcxx/test/std/utilities/format/format.functions/format_tests.h +++ b/libcxx/test/std/utilities/format/format.functions/format_tests.h @@ -393,54 +393,7 @@ // See locale-specific_form.pass.cpp // *** type *** - for (const auto& fmt : invalid_types("bBcdosxX")) - check_exception("The format-spec type has a type not supported for a bool argument", fmt, true); -} - -template -void format_test_bool_as_char(TestFunction check, ExceptionTest check_exception) { - // *** align-fill & width *** - check(SV("answer is '\1 '"), SV("answer is '{:6c}'"), true); - check(SV("answer is ' \1'"), SV("answer is '{:>6c}'"), true); - check(SV("answer is '\1 '"), SV("answer is '{:<6c}'"), true); - check(SV("answer is ' \1 '"), SV("answer is '{:^6c}'"), true); - - check(SV("answer is '-----\1'"), SV("answer is '{:->6c}'"), true); - check(SV("answer is '\1-----'"), SV("answer is '{:-<6c}'"), true); - check(SV("answer is '--\1---'"), SV("answer is '{:-^6c}'"), true); - - check(std::basic_string_view(CSTR("answer is '\0 '"), 18), SV("answer is '{:6c}'"), false); - check(std::basic_string_view(CSTR("answer is '\0 '"), 18), SV("answer is '{:6c}'"), false); - check(std::basic_string_view(CSTR("answer is ' \0'"), 18), SV("answer is '{:>6c}'"), false); - check(std::basic_string_view(CSTR("answer is '\0 '"), 18), SV("answer is '{:<6c}'"), false); - check(std::basic_string_view(CSTR("answer is ' \0 '"), 18), SV("answer is '{:^6c}'"), false); - - check(std::basic_string_view(CSTR("answer is '-----\0'"), 18), SV("answer is '{:->6c}'"), false); - check(std::basic_string_view(CSTR("answer is '\0-----'"), 18), SV("answer is '{:-<6c}'"), false); - check(std::basic_string_view(CSTR("answer is '--\0---'"), 18), SV("answer is '{:-^6c}'"), false); - - // *** Sign *** - check_exception("A sign field isn't allowed in this format-spec", SV("{:-c}"), true); - check_exception("A sign field isn't allowed in this format-spec", SV("{:+c}"), true); - check_exception("A sign field isn't allowed in this format-spec", SV("{: c}"), true); - - // *** alternate form *** - check_exception("An alternate form field isn't allowed in this format-spec", SV("{:#c}"), true); - - // *** zero-padding *** - check_exception("A zero-padding field isn't allowed in this format-spec", SV("{:0c}"), true); - - // *** precision *** - check_exception("The format-spec should consume the input or end with a '}'", SV("{:.c}"), true); - check_exception("The format-spec should consume the input or end with a '}'", SV("{:.0c}"), true); - check_exception("The format-spec should consume the input or end with a '}'", SV("{:.42c}"), true); - - // *** locale-specific form *** - // Note it has no effect but it's allowed. - check(SV("answer is '*'"), SV("answer is '{:Lc}'"), '*'); - - // *** type *** - for (const auto& fmt : invalid_types("bBcdosxX")) + for (const auto& fmt : invalid_types("bBdosxX")) check_exception("The format-spec type has a type not supported for a bool argument", fmt, true); } @@ -2550,7 +2503,6 @@ check(SV("hello false true"), SV("hello {} {}"), false, true); format_test_bool(check, check_exception); - format_test_bool_as_char(check, check_exception); format_test_bool_as_integer(check, check_exception); // *** Test signed integral format argument ***