[libcxx-commits] [libcxx] b6d6b8c - [libc++][format] LWG-3654 basic_format_context::arg(size_t) should be noexcept

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Fri Feb 11 08:42:24 PST 2022


Author: Mark de Wever
Date: 2022-02-11T17:42:06+01:00
New Revision: b6d6b8c9d87667816ce299aed24bc33cdfe28cf7

URL: https://github.com/llvm/llvm-project/commit/b6d6b8c9d87667816ce299aed24bc33cdfe28cf7
DIFF: https://github.com/llvm/llvm-project/commit/b6d6b8c9d87667816ce299aed24bc33cdfe28cf7.diff

LOG: [libc++][format] LWG-3654 basic_format_context::arg(size_t) should be noexcept

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D119349

Added: 
    

Modified: 
    libcxx/docs/Status/Cxx2bIssues.csv
    libcxx/include/__format/format_context.h
    libcxx/test/std/utilities/format/format.formatter/format.context/format.context/arg.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/docs/Status/Cxx2bIssues.csv b/libcxx/docs/Status/Cxx2bIssues.csv
index 45fa9826ec0a5..f335a3b2fa1d8 100644
--- a/libcxx/docs/Status/Cxx2bIssues.csv
+++ b/libcxx/docs/Status/Cxx2bIssues.csv
@@ -154,7 +154,7 @@
 "`3648 <https://wg21.link/LWG3648>`__","``format`` should not print ``bool`` with ``'c'`` ","February 2022","","","|format|"
 "`3649 <https://wg21.link/LWG3649>`__","[fund.ts.v2] Reinstate and bump ``__cpp_lib_experimental_memory_resource`` feature test macro","February 2022","",""
 "`3650 <https://wg21.link/LWG3650>`__","Are ``std::basic_string`` 's ``iterator`` and ``const_iterator`` constexpr iterators?","February 2022","|Nothing to do|",""
-"`3654 <https://wg21.link/LWG3654>`__","``basic_format_context::arg(size_t)`` should be ``noexcept`` ","February 2022","","","|format|"
+"`3654 <https://wg21.link/LWG3654>`__","``basic_format_context::arg(size_t)`` should be ``noexcept`` ","February 2022","|Complete|","15.0","|format|"
 "`3657 <https://wg21.link/LWG3657>`__","``std::hash<std::filesystem::path>`` is not enabled","February 2022","",""
 "`3660 <https://wg21.link/LWG3660>`__","``iterator_traits<common_iterator>::pointer`` should conform to ยง[iterator.traits]","February 2022","|Complete|","14.0"
 "`3661 <https://wg21.link/LWG3661>`__","``constinit atomic<shared_ptr<T>> a (nullptr);`` should work","February 2022","",""

diff  --git a/libcxx/include/__format/format_context.h b/libcxx/include/__format/format_context.h
index 705dbd54db02b..d4bc35decda64 100644
--- a/libcxx/include/__format/format_context.h
+++ b/libcxx/include/__format/format_context.h
@@ -98,7 +98,7 @@ class
   basic_format_context& operator=(const basic_format_context&) = delete;
 
   _LIBCPP_HIDE_FROM_ABI basic_format_arg<basic_format_context>
-  arg(size_t __id) const {
+  arg(size_t __id) const noexcept {
     return __args_.get(__id);
   }
 #ifndef _LIBCPP_HAS_NO_LOCALIZATION

diff  --git a/libcxx/test/std/utilities/format/format.formatter/format.context/format.context/arg.pass.cpp b/libcxx/test/std/utilities/format/format.formatter/format.context/format.context/arg.pass.cpp
index 8e8afa9edc405..db8121b9bec54 100644
--- a/libcxx/test/std/utilities/format/format.formatter/format.context/format.context/arg.pass.cpp
+++ b/libcxx/test/std/utilities/format/format.formatter/format.context/format.context/arg.pass.cpp
@@ -34,6 +34,7 @@ void test() {
   const std::basic_format_context context =
       test_format_context_create(OutIt{output}, args);
   LIBCPP_ASSERT(args.__size() == 4);
+  ASSERT_NOEXCEPT(context.arg(0));
   for (size_t i = 0, e = args.__size(); i != e; ++i) {
     assert(context.arg(i));
   }


        


More information about the libcxx-commits mailing list