[libcxx-commits] [libcxx] 2dc6281 - [libc++]Declaring '__asign_view__' as a non noexcept function

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Fri Aug 25 09:26:32 PDT 2023


Author: Rishabh Bali
Date: 2023-08-25T18:26:22+02:00
New Revision: 2dc6281b98d07f43a64d0ef34405d9a12d59e8b6

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

LOG:  [libc++]Declaring '__asign_view__'  as a non noexcept function

`__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 a `std::terminate()` call when allocation of a new string fails.

Fixes : https://github.com/llvm/llvm-project/issues/64858

Reviewed By: Mordante, #libc

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

Added: 
    

Modified: 
    libcxx/include/__filesystem/path.h

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__filesystem/path.h b/libcxx/include/__filesystem/path.h
index 6f9521fd93ce7b..0c234edf9eb9ce 100644
--- a/libcxx/include/__filesystem/path.h
+++ b/libcxx/include/__filesystem/path.h
@@ -1069,8 +1069,7 @@ class _LIBCPP_EXPORTED_FROM_ABI path {
 #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;
   }


        


More information about the libcxx-commits mailing list