[libcxx-commits] [PATCH] D116815: [libc++] basic_string::resize_and_overwrite: Adopt LWG3645 (Not voted in yet)

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jan 20 09:42:48 PST 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG48224475222d: [libc++] basic_string::resize_and_overwrite: Adopt LWG3645 (Not voted in yet) (authored by philnik).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116815/new/

https://reviews.llvm.org/D116815

Files:
  libcxx/docs/Status/Cxx2bIssues.csv
  libcxx/include/string
  libcxx/test/std/strings/basic.string/string.capacity/resize_and_overwrite.pass.cpp


Index: libcxx/test/std/strings/basic.string/string.capacity/resize_and_overwrite.pass.cpp
===================================================================
--- libcxx/test/std/strings/basic.string/string.capacity/resize_and_overwrite.pass.cpp
+++ libcxx/test/std/strings/basic.string/string.capacity/resize_and_overwrite.pass.cpp
@@ -76,7 +76,8 @@
 
 void test_value_categories() {
   std::string s;
-  s.resize_and_overwrite(10, [](char*&, size_t&) { return 0; });
+  s.resize_and_overwrite(10, [](char*&&, size_t&&) { return 0; });
+  s.resize_and_overwrite(10, [](char* const&, const size_t&) { return 0; });
   struct RefQualified {
     int operator()(char*, size_t) && { return 0; }
   };
Index: libcxx/include/string
===================================================================
--- libcxx/include/string
+++ libcxx/include/string
@@ -979,8 +979,7 @@
     _LIBCPP_HIDE_FROM_ABI constexpr
     void resize_and_overwrite(size_type __n, _Op __op) {
       __resize_default_init(__n);
-      pointer __data = data();
-      __erase_to_end(_VSTD::move(__op)(__data, __n));
+      __erase_to_end(_VSTD::move(__op)(data(), _LIBCPP_AUTO_CAST(__n)));
     }
 #endif
 
Index: libcxx/docs/Status/Cxx2bIssues.csv
===================================================================
--- libcxx/docs/Status/Cxx2bIssues.csv
+++ libcxx/docs/Status/Cxx2bIssues.csv
@@ -137,3 +137,5 @@
 `3593 <https://wg21.link/LWG3593>`__,"Several iterators' ``base() const &`` and ``lazy_split_view::outer-iterator::value_type::end()`` missing ``noexcept``","October 2021","","","|ranges|"
 `3595 <https://wg21.link/LWG3595>`__,"Exposition-only classes proxy and postfix-proxy for ``common_iterator`` should be fully ``constexpr``","October 2021","","","|ranges|"
 "","","","",""
+`3645 <https://wg21.link/LWG3645>`__,"``resize_and_overwrite`` is overspecified to call its callback with lvalues", "Not voted in","|Complete|","14.0",""
+"","","","",""
\ No newline at end of file


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116815.401675.patch
Type: text/x-patch
Size: 1961 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220120/6503f60a/attachment.bin>


More information about the libcxx-commits mailing list