diff --git a/libcxx/docs/Status/Cxx2bIssues.csv b/libcxx/docs/Status/Cxx2bIssues.csv --- a/libcxx/docs/Status/Cxx2bIssues.csv +++ b/libcxx/docs/Status/Cxx2bIssues.csv @@ -305,6 +305,6 @@ "`3878 `__","import ``std;`` should guarantee initialization of standard iostreams objects","February 2023","","","" "`3879 `__","``erase_if`` for ``flat_{,multi}set`` is incorrectly specified","February 2023","","","" "`3880 `__","Clarify ``operator+=`` complexity for ``{chunk,stride}_view::iterator``","February 2023","","","|ranges|" -"`3881 `__","Incorrect formatting of container adapters backed by ``std::string``","February 2023","","","|format|" +"`3881 `__","Incorrect formatting of container adapters backed by ``std::string``","February 2023","|Complete|","17.0","|format|" "","","","","","" "`3343 `__","Ordering of calls to ``unlock()`` and ``notify_all()`` in Effects element of ``notify_all_at_thread_exit()`` should be reversed","Not Yet Adopted","|Complete|","16.0","" diff --git a/libcxx/include/__format/container_adaptor.h b/libcxx/include/__format/container_adaptor.h --- a/libcxx/include/__format/container_adaptor.h +++ b/libcxx/include/__format/container_adaptor.h @@ -19,6 +19,8 @@ #include <__format/concepts.h> #include <__format/formatter.h> #include <__format/range_default_formatter.h> +#include <__ranges/all.h> +#include <__ranges/ref_view.h> #include #include @@ -35,8 +37,9 @@ template struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __formatter_container_adaptor { private: - using __maybe_const_adaptor = __fmt_maybe_const<_Adaptor, _CharT>; - formatter __underlying_; + using __maybe_const_container = __fmt_maybe_const; + using __maybe_const_adaptor = __maybe_const, _Adaptor>; + formatter, _CharT> __underlying_; public: template 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 @@ -250,6 +250,14 @@ test_char_escaped_string( check, check_exception, std::priority_queue{input.begin(), input.end(), std::greater{}}); test_char_escaped_string(check, check_exception, std::stack{input.begin(), input.end()}); + + // LWG3881 fixes formatting container adaptors backed by a std::string. + test_char_default(check, check_exception, std::queue{std::basic_string{input.begin(), input.end()}}); + test_char_default( + check, + check_exception, + std::priority_queue{std::greater{}, std::basic_string{input.begin(), input.end()}}); + test_char_default(check, check_exception, std::stack{std::basic_string{input.begin(), input.end()}}); } //