[libcxx-commits] [PATCH] D158826: Declaring '__asign_view__' as a non noexcept function

Rishabh Bali via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Aug 25 02:36:39 PDT 2023


Ris-Bali created this revision.
Ris-Bali added reviewers: cor3ntin, Mordante.
Ris-Bali added a project: libc++.
Herald added a project: All.
Ris-Bali requested review of this revision.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

'__assign_view__'  is declared as a noexcept function in ' libcxx/include/__filesystem/path.h' however internally it calls 'std::basic_string<char>::basic_string<char>(std::string_view)' which is not a noexcept function this may lead to an `std::terminate()` call whgen allocation of a new string fails.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158826

Files:
  libcxx/include/__filesystem/path.h


Index: libcxx/include/__filesystem/path.h
===================================================================
--- libcxx/include/__filesystem/path.h
+++ libcxx/include/__filesystem/path.h
@@ -1069,8 +1069,7 @@
 #endif // !_LIBCPP_HAS_NO_LOCALIZATION
 
 private:
-  inline _LIBCPP_HIDE_FROM_ABI path&
-  __assign_view(__string_view const& __s) noexcept {
+  inline _LIBCPP_HIDE_FROM_ABI path& __assign_view(__string_view const& __s) {
     __pn_ = string_type(__s);
     return *this;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158826.553417.patch
Type: text/x-patch
Size: 489 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230825/70055b28/attachment.bin>


More information about the libcxx-commits mailing list