diff --git a/libcxx/include/__format/formatter_string.h b/libcxx/include/__format/formatter_string.h --- a/libcxx/include/__format/formatter_string.h +++ b/libcxx/include/__format/formatter_string.h @@ -52,7 +52,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr void set_debug_format() { __parser_.__type_ = __format_spec::__type::__debug; } # endif - __format_spec::__parser<_CharT> __parser_; + __format_spec::__parser<_CharT> __parser_{.__alignment_ = __format_spec::__alignment::__left}; }; // Formatter const char*. 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 @@ -201,6 +201,7 @@ check(SV("hello universe and world"), SV("hello {1} and {0}"), world, universe); check(SV("hello world"), SV("hello {:_>}"), world); + check(SV("hello world "), SV("hello {:8}"), world); check(SV("hello world"), SV("hello {:>8}"), world); check(SV("hello ___world"), SV("hello {:_>8}"), world); check(SV("hello _world__"), SV("hello {:_^8}"), world); @@ -883,7 +884,6 @@ // ***** Char type ***** // *** align-fill & width *** check(SV("answer is '* '"), SV("answer is '{:6}'"), CharT('*')); - check(SV("answer is ' *'"), SV("answer is '{:>6}'"), CharT('*')); check(SV("answer is '* '"), SV("answer is '{:<6}'"), CharT('*')); check(SV("answer is ' * '"), SV("answer is '{:^6}'"), CharT('*'));