[libcxx-commits] [libcxx] [libc++] Qualify calls to nullary functions like __throw_foo (PR #122465)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Feb 19 10:51:54 PST 2025


https://github.com/ldionne updated https://github.com/llvm/llvm-project/pull/122465

>From d10e60edab24398c780d2814e9af73ab1c7a4e97 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Fri, 10 Jan 2025 09:36:23 -0500
Subject: [PATCH 1/6] [libc++] Qualify calls to __throw_foo & friends

This is technically not necessary in most cases to prevent issues with
ADL, but let's be consistent.
---
 .../__condition_variable/condition_variable.h |   4 +-
 libcxx/include/__filesystem/directory_entry.h |   2 +-
 libcxx/include/__functional/function.h        |   4 +-
 libcxx/include/__locale                       |  10 +-
 libcxx/include/__locale_dir/support/windows.h |   2 +-
 libcxx/include/__memory/allocator.h           |   2 +-
 libcxx/include/__memory/shared_ptr.h          |   2 +-
 .../__memory_resource/polymorphic_allocator.h |   2 +-
 libcxx/include/__mutex/unique_lock.h          |  18 +--
 libcxx/include/__ostream/basic_ostream.h      |   2 +-
 libcxx/include/__thread/thread.h              |   6 +-
 libcxx/include/__vector/vector.h              |   2 +-
 libcxx/include/__vector/vector_bool.h         |   2 +-
 libcxx/include/any                            |   6 +-
 libcxx/include/array                          |   8 +-
 libcxx/include/bitset                         |  14 +-
 libcxx/include/fstream                        |   8 +-
 libcxx/include/future                         |  54 ++++----
 libcxx/include/locale                         |  24 ++--
 libcxx/include/map                            |   4 +-
 libcxx/include/optional                       |   8 +-
 libcxx/include/regex                          | 130 +++++++++---------
 libcxx/include/shared_mutex                   |  18 +--
 libcxx/include/string                         |  56 ++++----
 libcxx/include/string_view                    |   2 +-
 libcxx/include/unordered_map                  |   4 +-
 libcxx/include/variant                        |   4 +-
 libcxx/src/chrono.cpp                         |  12 +-
 libcxx/src/condition_variable.cpp             |   8 +-
 libcxx/src/filesystem/error.h                 |  12 +-
 libcxx/src/filesystem/filesystem_clock.cpp    |   4 +-
 libcxx/src/future.cpp                         |  20 +--
 libcxx/src/hash.cpp                           |   4 +-
 libcxx/src/ios.cpp                            |  10 +-
 libcxx/src/locale.cpp                         |  68 ++++-----
 libcxx/src/memory_resource.cpp                |   4 +-
 libcxx/src/mutex.cpp                          |   8 +-
 libcxx/src/print.cpp                          |   2 +-
 libcxx/src/random.cpp                         |  24 ++--
 libcxx/src/std_stream.h                       |   2 +-
 libcxx/src/thread.cpp                         |   4 +-
 41 files changed, 290 insertions(+), 290 deletions(-)

diff --git a/libcxx/include/__condition_variable/condition_variable.h b/libcxx/include/__condition_variable/condition_variable.h
index 4521fe274614e..82ecb804669e6 100644
--- a/libcxx/include/__condition_variable/condition_variable.h
+++ b/libcxx/include/__condition_variable/condition_variable.h
@@ -210,7 +210,7 @@ inline void condition_variable::__do_timed_wait(
     unique_lock<mutex>& __lk, chrono::time_point<chrono::steady_clock, chrono::nanoseconds> __tp) _NOEXCEPT {
   using namespace chrono;
   if (!__lk.owns_lock())
-    __throw_system_error(EPERM, "condition_variable::timed wait: mutex not locked");
+    std::__throw_system_error(EPERM, "condition_variable::timed wait: mutex not locked");
   nanoseconds __d = __tp.time_since_epoch();
   timespec __ts;
   seconds __s                 = duration_cast<seconds>(__d);
@@ -225,7 +225,7 @@ inline void condition_variable::__do_timed_wait(
   }
   int __ec = pthread_cond_clockwait(&__cv_, __lk.mutex()->native_handle(), CLOCK_MONOTONIC, &__ts);
   if (__ec != 0 && __ec != ETIMEDOUT)
-    __throw_system_error(__ec, "condition_variable timed_wait failed");
+    std::__throw_system_error(__ec, "condition_variable timed_wait failed");
 }
 #  endif // _LIBCPP_HAS_COND_CLOCKWAIT
 
diff --git a/libcxx/include/__filesystem/directory_entry.h b/libcxx/include/__filesystem/directory_entry.h
index 11e07acdbe00c..5f236cf2648df 100644
--- a/libcxx/include/__filesystem/directory_entry.h
+++ b/libcxx/include/__filesystem/directory_entry.h
@@ -286,7 +286,7 @@ class directory_entry {
       return;
     }
     if (__ec && (!__allow_dne || !__is_dne_error(__ec)))
-      __throw_filesystem_error(__msg, __p_, __ec);
+      filesystem::__throw_filesystem_error(__msg, __p_, __ec);
   }
 
   _LIBCPP_HIDE_FROM_ABI void __refresh(error_code* __ec = nullptr) {
diff --git a/libcxx/include/__functional/function.h b/libcxx/include/__functional/function.h
index 2a1293cfcc26b..cb800c6b3d192 100644
--- a/libcxx/include/__functional/function.h
+++ b/libcxx/include/__functional/function.h
@@ -432,7 +432,7 @@ class __value_func<_Rp(_ArgTypes...)> {
 
   _LIBCPP_HIDE_FROM_ABI _Rp operator()(_ArgTypes&&... __args) const {
     if (__f_ == nullptr)
-      __throw_bad_function_call();
+      std::__throw_bad_function_call();
     return (*__f_)(std::forward<_ArgTypes>(__args)...);
   }
 
@@ -607,7 +607,7 @@ struct __policy_invoker<_Rp(_ArgTypes...)> {
   _LIBCPP_HIDE_FROM_ABI explicit __policy_invoker(__Call __c) : __call_(__c) {}
 
   _LIBCPP_HIDE_FROM_ABI static _Rp __call_empty(const __policy_storage*, __fast_forward<_ArgTypes>...) {
-    __throw_bad_function_call();
+    std::__throw_bad_function_call();
   }
 
   template <typename _Fun>
diff --git a/libcxx/include/__locale b/libcxx/include/__locale
index dfe79d5e506f1..9bd77cbf38906 100644
--- a/libcxx/include/__locale
+++ b/libcxx/include/__locale
@@ -154,7 +154,7 @@ inline _LIBCPP_HIDE_FROM_ABI locale::locale(const locale& __other, _Facet* __f)
 template <class _Facet>
 locale locale::combine(const locale& __other) const {
   if (!std::has_facet<_Facet>(__other))
-    __throw_runtime_error("locale::combine: locale missing facet");
+    std::__throw_runtime_error("locale::combine: locale missing facet");
 
   return locale(*this, &const_cast<_Facet&>(std::use_facet<_Facet>(__other)));
 }
@@ -1298,7 +1298,7 @@ struct _LIBCPP_EXPORTED_FROM_ABI __narrow_to_utf8<16> : public codecvt<char16_t,
       const char16_t* __wn = (const char16_t*)__wb;
       __r = do_out(__mb, (const char16_t*)__wb, (const char16_t*)__we, __wn, __buf, __buf + __sz, __bn);
       if (__r == codecvt_base::error || __wn == (const char16_t*)__wb)
-        __throw_runtime_error("locale not supported");
+        std::__throw_runtime_error("locale not supported");
       for (const char* __p = __buf; __p < __bn; ++__p, ++__s)
         *__s = *__p;
       __wb = (const _CharT*)__wn;
@@ -1326,7 +1326,7 @@ struct _LIBCPP_EXPORTED_FROM_ABI __narrow_to_utf8<32> : public codecvt<char32_t,
       const char32_t* __wn = (const char32_t*)__wb;
       __r = do_out(__mb, (const char32_t*)__wb, (const char32_t*)__we, __wn, __buf, __buf + __sz, __bn);
       if (__r == codecvt_base::error || __wn == (const char32_t*)__wb)
-        __throw_runtime_error("locale not supported");
+        std::__throw_runtime_error("locale not supported");
       for (const char* __p = __buf; __p < __bn; ++__p, ++__s)
         *__s = *__p;
       __wb = (const _CharT*)__wn;
@@ -1370,7 +1370,7 @@ struct _LIBCPP_EXPORTED_FROM_ABI __widen_from_utf8<16> : public codecvt<char16_t
       const char* __nn = __nb;
       __r              = do_in(__mb, __nb, __ne - __nb > __sz ? __nb + __sz : __ne, __nn, __buf, __buf + __sz, __bn);
       if (__r == codecvt_base::error || __nn == __nb)
-        __throw_runtime_error("locale not supported");
+        std::__throw_runtime_error("locale not supported");
       for (const char16_t* __p = __buf; __p < __bn; ++__p, ++__s)
         *__s = *__p;
       __nb = __nn;
@@ -1398,7 +1398,7 @@ struct _LIBCPP_EXPORTED_FROM_ABI __widen_from_utf8<32> : public codecvt<char32_t
       const char* __nn = __nb;
       __r              = do_in(__mb, __nb, __ne - __nb > __sz ? __nb + __sz : __ne, __nn, __buf, __buf + __sz, __bn);
       if (__r == codecvt_base::error || __nn == __nb)
-        __throw_runtime_error("locale not supported");
+        std::__throw_runtime_error("locale not supported");
       for (const char32_t* __p = __buf; __p < __bn; ++__p, ++__s)
         *__s = *__p;
       __nb = __nn;
diff --git a/libcxx/include/__locale_dir/support/windows.h b/libcxx/include/__locale_dir/support/windows.h
index f0f76c527264a..a902de6c55ef6 100644
--- a/libcxx/include/__locale_dir/support/windows.h
+++ b/libcxx/include/__locale_dir/support/windows.h
@@ -310,7 +310,7 @@ struct __locale_guard {
     if (std::strcmp(__l.__get_locale(), __lc) != 0) {
       __locale_all = _strdup(__lc);
       if (__locale_all == nullptr)
-        __throw_bad_alloc();
+        std::__throw_bad_alloc();
       __locale::__setlocale(LC_ALL, __l.__get_locale());
     }
   }
diff --git a/libcxx/include/__memory/allocator.h b/libcxx/include/__memory/allocator.h
index 191a59e6614a0..2620f1cafb430 100644
--- a/libcxx/include/__memory/allocator.h
+++ b/libcxx/include/__memory/allocator.h
@@ -98,7 +98,7 @@ class _LIBCPP_TEMPLATE_VIS allocator : private __non_trivial_if<!is_void<_Tp>::v
   [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp* allocate(size_t __n) {
     static_assert(sizeof(_Tp) >= 0, "cannot allocate memory for an incomplete type");
     if (__n > allocator_traits<allocator>::max_size(*this))
-      __throw_bad_array_new_length();
+      std::__throw_bad_array_new_length();
     if (__libcpp_is_constant_evaluated()) {
       return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp)));
     } else {
diff --git a/libcxx/include/__memory/shared_ptr.h b/libcxx/include/__memory/shared_ptr.h
index d513fa692c1f9..e1d49c4594866 100644
--- a/libcxx/include/__memory/shared_ptr.h
+++ b/libcxx/include/__memory/shared_ptr.h
@@ -497,7 +497,7 @@ class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS shared_ptr {
   _LIBCPP_HIDE_FROM_ABI explicit shared_ptr(const weak_ptr<_Yp>& __r)
       : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_ ? __r.__cntrl_->lock() : __r.__cntrl_) {
     if (__cntrl_ == nullptr)
-      __throw_bad_weak_ptr();
+      std::__throw_bad_weak_ptr();
   }
 
 #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
diff --git a/libcxx/include/__memory_resource/polymorphic_allocator.h b/libcxx/include/__memory_resource/polymorphic_allocator.h
index 2dec9788852c2..7e7eca5c64fb6 100644
--- a/libcxx/include/__memory_resource/polymorphic_allocator.h
+++ b/libcxx/include/__memory_resource/polymorphic_allocator.h
@@ -64,7 +64,7 @@ class _LIBCPP_AVAILABILITY_PMR _LIBCPP_TEMPLATE_VIS polymorphic_allocator {
 
   [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _ValueType* allocate(size_t __n) {
     if (__n > __max_size()) {
-      __throw_bad_array_new_length();
+      std::__throw_bad_array_new_length();
     }
     return static_cast<_ValueType*>(__res_->allocate(__n * sizeof(_ValueType), alignof(_ValueType)));
   }
diff --git a/libcxx/include/__mutex/unique_lock.h b/libcxx/include/__mutex/unique_lock.h
index 3642ab93cb1f7..84073ef4b5114 100644
--- a/libcxx/include/__mutex/unique_lock.h
+++ b/libcxx/include/__mutex/unique_lock.h
@@ -116,9 +116,9 @@ _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(unique_lock);
 template <class _Mutex>
 _LIBCPP_HIDE_FROM_ABI void unique_lock<_Mutex>::lock() {
   if (__m_ == nullptr)
-    __throw_system_error(EPERM, "unique_lock::lock: references null mutex");
+    std::__throw_system_error(EPERM, "unique_lock::lock: references null mutex");
   if (__owns_)
-    __throw_system_error(EDEADLK, "unique_lock::lock: already locked");
+    std::__throw_system_error(EDEADLK, "unique_lock::lock: already locked");
   __m_->lock();
   __owns_ = true;
 }
@@ -126,9 +126,9 @@ _LIBCPP_HIDE_FROM_ABI void unique_lock<_Mutex>::lock() {
 template <class _Mutex>
 _LIBCPP_HIDE_FROM_ABI bool unique_lock<_Mutex>::try_lock() {
   if (__m_ == nullptr)
-    __throw_system_error(EPERM, "unique_lock::try_lock: references null mutex");
+    std::__throw_system_error(EPERM, "unique_lock::try_lock: references null mutex");
   if (__owns_)
-    __throw_system_error(EDEADLK, "unique_lock::try_lock: already locked");
+    std::__throw_system_error(EDEADLK, "unique_lock::try_lock: already locked");
   __owns_ = __m_->try_lock();
   return __owns_;
 }
@@ -137,9 +137,9 @@ template <class _Mutex>
 template <class _Rep, class _Period>
 _LIBCPP_HIDE_FROM_ABI bool unique_lock<_Mutex>::try_lock_for(const chrono::duration<_Rep, _Period>& __d) {
   if (__m_ == nullptr)
-    __throw_system_error(EPERM, "unique_lock::try_lock_for: references null mutex");
+    std::__throw_system_error(EPERM, "unique_lock::try_lock_for: references null mutex");
   if (__owns_)
-    __throw_system_error(EDEADLK, "unique_lock::try_lock_for: already locked");
+    std::__throw_system_error(EDEADLK, "unique_lock::try_lock_for: already locked");
   __owns_ = __m_->try_lock_for(__d);
   return __owns_;
 }
@@ -148,9 +148,9 @@ template <class _Mutex>
 template <class _Clock, class _Duration>
 _LIBCPP_HIDE_FROM_ABI bool unique_lock<_Mutex>::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t) {
   if (__m_ == nullptr)
-    __throw_system_error(EPERM, "unique_lock::try_lock_until: references null mutex");
+    std::__throw_system_error(EPERM, "unique_lock::try_lock_until: references null mutex");
   if (__owns_)
-    __throw_system_error(EDEADLK, "unique_lock::try_lock_until: already locked");
+    std::__throw_system_error(EDEADLK, "unique_lock::try_lock_until: already locked");
   __owns_ = __m_->try_lock_until(__t);
   return __owns_;
 }
@@ -158,7 +158,7 @@ _LIBCPP_HIDE_FROM_ABI bool unique_lock<_Mutex>::try_lock_until(const chrono::tim
 template <class _Mutex>
 _LIBCPP_HIDE_FROM_ABI void unique_lock<_Mutex>::unlock() {
   if (!__owns_)
-    __throw_system_error(EPERM, "unique_lock::unlock: not locked");
+    std::__throw_system_error(EPERM, "unique_lock::unlock: not locked");
   __m_->unlock();
   __owns_ = false;
 }
diff --git a/libcxx/include/__ostream/basic_ostream.h b/libcxx/include/__ostream/basic_ostream.h
index 97226476e5ef0..06bf54a5bd2f6 100644
--- a/libcxx/include/__ostream/basic_ostream.h
+++ b/libcxx/include/__ostream/basic_ostream.h
@@ -407,7 +407,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn) {
       if (__len > __bs) {
         __wb = (_CharT*)malloc(__len * sizeof(_CharT));
         if (__wb == 0)
-          __throw_bad_alloc();
+          std::__throw_bad_alloc();
         __h.reset(__wb);
       }
       for (_CharT* __p = __wb; *__strn != '\0'; ++__strn, ++__p)
diff --git a/libcxx/include/__thread/thread.h b/libcxx/include/__thread/thread.h
index c40ffd25b903c..8e5b97f2a5c00 100644
--- a/libcxx/include/__thread/thread.h
+++ b/libcxx/include/__thread/thread.h
@@ -100,7 +100,7 @@ template <class _Tp>
 __thread_specific_ptr<_Tp>::__thread_specific_ptr() {
   int __ec = __libcpp_tls_create(&__key_, &__thread_specific_ptr::__at_thread_exit);
   if (__ec)
-    __throw_system_error(__ec, "__thread_specific_ptr construction failed");
+    std::__throw_system_error(__ec, "__thread_specific_ptr construction failed");
 }
 
 template <class _Tp>
@@ -219,7 +219,7 @@ thread::thread(_Fp&& __f, _Args&&... __args) {
   if (__ec == 0)
     __p.release();
   else
-    __throw_system_error(__ec, "thread constructor failed");
+    std::__throw_system_error(__ec, "thread constructor failed");
 }
 
 #  else // _LIBCPP_CXX03_LANG
@@ -251,7 +251,7 @@ thread::thread(_Fp __f) {
   if (__ec == 0)
     __pp.release();
   else
-    __throw_system_error(__ec, "thread constructor failed");
+    std::__throw_system_error(__ec, "thread constructor failed");
 }
 
 #  endif // _LIBCPP_CXX03_LANG
diff --git a/libcxx/include/__vector/vector.h b/libcxx/include/__vector/vector.h
index 244506065db61..ef796a8ed0a9e 100644
--- a/libcxx/include/__vector/vector.h
+++ b/libcxx/include/__vector/vector.h
@@ -555,7 +555,7 @@ class _LIBCPP_TEMPLATE_VIS vector {
   //  Postcondition:  size() == 0
   _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __vallocate(size_type __n) {
     if (__n > max_size())
-      __throw_length_error();
+      this->__throw_length_error();
     auto __allocation = std::__allocate_at_least(this->__alloc_, __n);
     __begin_          = __allocation.ptr;
     __end_            = __allocation.ptr;
diff --git a/libcxx/include/__vector/vector_bool.h b/libcxx/include/__vector/vector_bool.h
index 714c86ae2bb96..1d3960bd01597 100644
--- a/libcxx/include/__vector/vector_bool.h
+++ b/libcxx/include/__vector/vector_bool.h
@@ -446,7 +446,7 @@ class _LIBCPP_TEMPLATE_VIS vector<bool, _Allocator> {
   //  Postcondition:  size() == 0
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __vallocate(size_type __n) {
     if (__n > max_size())
-      __throw_length_error();
+      this->__throw_length_error();
     auto __allocation = std::__allocate_at_least(__alloc_, __external_cap_to_internal(__n));
     __begin_          = __allocation.ptr;
     __size_           = 0;
diff --git a/libcxx/include/any b/libcxx/include/any
index 786e86b5ccd8b..b1df494d3db83 100644
--- a/libcxx/include/any
+++ b/libcxx/include/any
@@ -526,7 +526,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _ValueType
                 "or a CopyConstructible type");
   auto __tmp = std::any_cast<add_const_t<_RawValueType>>(&__v);
   if (__tmp == nullptr)
-    __throw_bad_any_cast();
+    std::__throw_bad_any_cast();
   return static_cast<_ValueType>(*__tmp);
 }
 
@@ -538,7 +538,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _ValueType
                 "or a CopyConstructible type");
   auto __tmp = std::any_cast<_RawValueType>(&__v);
   if (__tmp == nullptr)
-    __throw_bad_any_cast();
+    std::__throw_bad_any_cast();
   return static_cast<_ValueType>(*__tmp);
 }
 
@@ -550,7 +550,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _ValueType
                 "or a CopyConstructible type");
   auto __tmp = std::any_cast<_RawValueType>(&__v);
   if (__tmp == nullptr)
-    __throw_bad_any_cast();
+    std::__throw_bad_any_cast();
   return static_cast<_ValueType>(std::move(*__tmp));
 }
 
diff --git a/libcxx/include/array b/libcxx/include/array
index 1b9bcd6891d95..44c6bb5c5cc93 100644
--- a/libcxx/include/array
+++ b/libcxx/include/array
@@ -276,13 +276,13 @@ struct _LIBCPP_TEMPLATE_VIS array {
 
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference at(size_type __n) {
     if (__n >= _Size)
-      __throw_out_of_range("array::at");
+      std::__throw_out_of_range("array::at");
     return __elems_[__n];
   }
 
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference at(size_type __n) const {
     if (__n >= _Size)
-      __throw_out_of_range("array::at");
+      std::__throw_out_of_range("array::at");
     return __elems_[__n];
   }
 
@@ -407,12 +407,12 @@ struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0> {
   }
 
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 reference at(size_type) {
-    __throw_out_of_range("array<T, 0>::at");
+    std::__throw_out_of_range("array<T, 0>::at");
     __libcpp_unreachable();
   }
 
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference at(size_type) const {
-    __throw_out_of_range("array<T, 0>::at");
+    std::__throw_out_of_range("array<T, 0>::at");
     __libcpp_unreachable();
   }
 
diff --git a/libcxx/include/bitset b/libcxx/include/bitset
index a20842985b3d5..ab1dda739c7d5 100644
--- a/libcxx/include/bitset
+++ b/libcxx/include/bitset
@@ -343,7 +343,7 @@ __bitset<_N_words, _Size>::to_ulong(false_type) const {
   __const_iterator __e = __make_iter(_Size);
   __const_iterator __i = std::find(__make_iter(sizeof(unsigned long) * CHAR_BIT), __e, true);
   if (__i != __e)
-    __throw_overflow_error("bitset to_ulong overflow error");
+    std::__throw_overflow_error("bitset to_ulong overflow error");
 
   return __first_[0];
 }
@@ -360,7 +360,7 @@ __bitset<_N_words, _Size>::to_ullong(false_type) const {
   __const_iterator __e = __make_iter(_Size);
   __const_iterator __i = std::find(__make_iter(sizeof(unsigned long long) * CHAR_BIT), __e, true);
   if (__i != __e)
-    __throw_overflow_error("bitset to_ullong overflow error");
+    std::__throw_overflow_error("bitset to_ullong overflow error");
 
   return to_ullong(true_type());
 }
@@ -645,7 +645,7 @@ public:
       _CharT __zero                                                = _CharT('0'),
       _CharT __one                                                 = _CharT('1')) {
     if (__pos > __str.size())
-      __throw_out_of_range("bitset string pos out of range");
+      std::__throw_out_of_range("bitset string pos out of range");
 
     size_t __rlen = std::min(__n, __str.size() - __pos);
     __init_from_string_view(basic_string_view<_CharT, _Traits>(__str.data() + __pos, __rlen), __zero, __one);
@@ -790,7 +790,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset
 template <size_t _Size>
 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::set(size_t __pos, bool __val) {
   if (__pos >= _Size)
-    __throw_out_of_range("bitset set argument out of range");
+    std::__throw_out_of_range("bitset set argument out of range");
 
   (*this)[__pos] = __val;
   return *this;
@@ -805,7 +805,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset
 template <size_t _Size>
 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::reset(size_t __pos) {
   if (__pos >= _Size)
-    __throw_out_of_range("bitset reset argument out of range");
+    std::__throw_out_of_range("bitset reset argument out of range");
 
   (*this)[__pos] = false;
   return *this;
@@ -827,7 +827,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset
 template <size_t _Size>
 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bitset<_Size>& bitset<_Size>::flip(size_t __pos) {
   if (__pos >= _Size)
-    __throw_out_of_range("bitset flip argument out of range");
+    std::__throw_out_of_range("bitset flip argument out of range");
 
   reference __r = __base::__make_ref(__pos);
   __r           = ~__r;
@@ -899,7 +899,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool bitset<_Size>::operator!=(const bitset& __rhs)
 template <size_t _Size>
 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool bitset<_Size>::test(size_t __pos) const {
   if (__pos >= _Size)
-    __throw_out_of_range("bitset test argument out of range");
+    std::__throw_out_of_range("bitset test argument out of range");
 
   return (*this)[__pos];
 }
diff --git a/libcxx/include/fstream b/libcxx/include/fstream
index de5c07035dba9..e2eba51b58bd9 100644
--- a/libcxx/include/fstream
+++ b/libcxx/include/fstream
@@ -780,7 +780,7 @@ typename basic_filebuf<_CharT, _Traits>::int_type basic_filebuf<_CharT, _Traits>
       size_t __nr = fread((void*)const_cast<char*>(__extbufnext_), 1, __nmemb, __file_);
       if (__nr != 0) {
         if (!__cv_)
-          __throw_bad_cast();
+          std::__throw_bad_cast();
 
         __extbufend_ = __extbufnext_ + __nr;
         char_type* __inext;
@@ -842,7 +842,7 @@ typename basic_filebuf<_CharT, _Traits>::int_type basic_filebuf<_CharT, _Traits>
       codecvt_base::result __r;
       do {
         if (!__cv_)
-          __throw_bad_cast();
+          std::__throw_bad_cast();
 
         const char_type* __e;
         __r = __cv_->out(__st_, this->pbase(), this->pptr(), __e, __extbuf_, __extbuf_ + __ebs_, __extbe);
@@ -913,7 +913,7 @@ template <class _CharT, class _Traits>
 typename basic_filebuf<_CharT, _Traits>::pos_type
 basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode) {
   if (!__cv_)
-    __throw_bad_cast();
+    std::__throw_bad_cast();
 
   int __width = __cv_->encoding();
   if (__file_ == nullptr || (__width <= 0 && __off != 0) || sync())
@@ -978,7 +978,7 @@ int basic_filebuf<_CharT, _Traits>::sync() {
   if (__file_ == nullptr)
     return 0;
   if (!__cv_)
-    __throw_bad_cast();
+    std::__throw_bad_cast();
 
   if (__cm_ & ios_base::out) {
     if (this->pptr() != this->pbase())
diff --git a/libcxx/include/future b/libcxx/include/future
index db1f624244b8f..c17e79f8c03bc 100644
--- a/libcxx/include/future
+++ b/libcxx/include/future
@@ -541,7 +541,7 @@ public:
     lock_guard<mutex> __lk(__mut_);
     bool __has_future_attached = (__state_ & __future_attached) != 0;
     if (__has_future_attached)
-      __throw_future_error(future_errc::future_already_retrieved);
+      std::__throw_future_error(future_errc::future_already_retrieved);
     this->__add_shared();
     __state_ |= __future_attached;
   }
@@ -621,7 +621,7 @@ template <class _Arg>
 void __assoc_state<_Rp>::set_value(_Arg&& __arg) {
   unique_lock<mutex> __lk(this->__mut_);
   if (this->__has_value())
-    __throw_future_error(future_errc::promise_already_satisfied);
+    std::__throw_future_error(future_errc::promise_already_satisfied);
   ::new ((void*)&__value_) _Rp(std::forward<_Arg>(__arg));
   this->__state_ |= base::__constructed | base::ready;
   __cv_.notify_all();
@@ -632,7 +632,7 @@ template <class _Arg>
 void __assoc_state<_Rp>::set_value_at_thread_exit(_Arg&& __arg) {
   unique_lock<mutex> __lk(this->__mut_);
   if (this->__has_value())
-    __throw_future_error(future_errc::promise_already_satisfied);
+    std::__throw_future_error(future_errc::promise_already_satisfied);
   ::new ((void*)&__value_) _Rp(std::forward<_Arg>(__arg));
   this->__state_ |= base::__constructed;
   __thread_local_data()->__make_ready_at_thread_exit(this);
@@ -682,7 +682,7 @@ template <class _Rp>
 void __assoc_state<_Rp&>::set_value(_Rp& __arg) {
   unique_lock<mutex> __lk(this->__mut_);
   if (this->__has_value())
-    __throw_future_error(future_errc::promise_already_satisfied);
+    std::__throw_future_error(future_errc::promise_already_satisfied);
   __value_ = std::addressof(__arg);
   this->__state_ |= base::__constructed | base::ready;
   __cv_.notify_all();
@@ -692,7 +692,7 @@ template <class _Rp>
 void __assoc_state<_Rp&>::set_value_at_thread_exit(_Rp& __arg) {
   unique_lock<mutex> __lk(this->__mut_);
   if (this->__has_value())
-    __throw_future_error(future_errc::promise_already_satisfied);
+    std::__throw_future_error(future_errc::promise_already_satisfied);
   __value_ = std::addressof(__arg);
   this->__state_ |= base::__constructed;
   __thread_local_data()->__make_ready_at_thread_exit(this);
@@ -1185,21 +1185,21 @@ promise<_Rp>::~promise() {
 template <class _Rp>
 future<_Rp> promise<_Rp>::get_future() {
   if (__state_ == nullptr)
-    __throw_future_error(future_errc::no_state);
+    std::__throw_future_error(future_errc::no_state);
   return future<_Rp>(__state_);
 }
 
 template <class _Rp>
 void promise<_Rp>::set_value(const _Rp& __r) {
   if (__state_ == nullptr)
-    __throw_future_error(future_errc::no_state);
+    std::__throw_future_error(future_errc::no_state);
   __state_->set_value(__r);
 }
 
 template <class _Rp>
 void promise<_Rp>::set_value(_Rp&& __r) {
   if (__state_ == nullptr)
-    __throw_future_error(future_errc::no_state);
+    std::__throw_future_error(future_errc::no_state);
   __state_->set_value(std::move(__r));
 }
 
@@ -1207,21 +1207,21 @@ template <class _Rp>
 void promise<_Rp>::set_exception(exception_ptr __p) {
   _LIBCPP_ASSERT_NON_NULL(__p != nullptr, "promise::set_exception: received nullptr");
   if (__state_ == nullptr)
-    __throw_future_error(future_errc::no_state);
+    std::__throw_future_error(future_errc::no_state);
   __state_->set_exception(__p);
 }
 
 template <class _Rp>
 void promise<_Rp>::set_value_at_thread_exit(const _Rp& __r) {
   if (__state_ == nullptr)
-    __throw_future_error(future_errc::no_state);
+    std::__throw_future_error(future_errc::no_state);
   __state_->set_value_at_thread_exit(__r);
 }
 
 template <class _Rp>
 void promise<_Rp>::set_value_at_thread_exit(_Rp&& __r) {
   if (__state_ == nullptr)
-    __throw_future_error(future_errc::no_state);
+    std::__throw_future_error(future_errc::no_state);
   __state_->set_value_at_thread_exit(std::move(__r));
 }
 
@@ -1229,7 +1229,7 @@ template <class _Rp>
 void promise<_Rp>::set_exception_at_thread_exit(exception_ptr __p) {
   _LIBCPP_ASSERT_NON_NULL(__p != nullptr, "promise::set_exception_at_thread_exit: received nullptr");
   if (__state_ == nullptr)
-    __throw_future_error(future_errc::no_state);
+    std::__throw_future_error(future_errc::no_state);
   __state_->set_exception_at_thread_exit(__p);
 }
 
@@ -1300,14 +1300,14 @@ promise<_Rp&>::~promise() {
 template <class _Rp>
 future<_Rp&> promise<_Rp&>::get_future() {
   if (__state_ == nullptr)
-    __throw_future_error(future_errc::no_state);
+    std::__throw_future_error(future_errc::no_state);
   return future<_Rp&>(__state_);
 }
 
 template <class _Rp>
 void promise<_Rp&>::set_value(_Rp& __r) {
   if (__state_ == nullptr)
-    __throw_future_error(future_errc::no_state);
+    std::__throw_future_error(future_errc::no_state);
   __state_->set_value(__r);
 }
 
@@ -1315,14 +1315,14 @@ template <class _Rp>
 void promise<_Rp&>::set_exception(exception_ptr __p) {
   _LIBCPP_ASSERT_NON_NULL(__p != nullptr, "promise::set_exception: received nullptr");
   if (__state_ == nullptr)
-    __throw_future_error(future_errc::no_state);
+    std::__throw_future_error(future_errc::no_state);
   __state_->set_exception(__p);
 }
 
 template <class _Rp>
 void promise<_Rp&>::set_value_at_thread_exit(_Rp& __r) {
   if (__state_ == nullptr)
-    __throw_future_error(future_errc::no_state);
+    std::__throw_future_error(future_errc::no_state);
   __state_->set_value_at_thread_exit(__r);
 }
 
@@ -1330,7 +1330,7 @@ template <class _Rp>
 void promise<_Rp&>::set_exception_at_thread_exit(exception_ptr __p) {
   _LIBCPP_ASSERT_NON_NULL(__p != nullptr, "promise::set_exception_at_thread_exit: received nullptr");
   if (__state_ == nullptr)
-    __throw_future_error(future_errc::no_state);
+    std::__throw_future_error(future_errc::no_state);
   __state_->set_exception_at_thread_exit(__p);
 }
 
@@ -1665,9 +1665,9 @@ public:
 template <class _Rp, class... _ArgTypes>
 void packaged_task<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __args) {
   if (__p_.__state_ == nullptr)
-    __throw_future_error(future_errc::no_state);
+    std::__throw_future_error(future_errc::no_state);
   if (__p_.__state_->__has_value())
-    __throw_future_error(future_errc::promise_already_satisfied);
+    std::__throw_future_error(future_errc::promise_already_satisfied);
 #    if _LIBCPP_HAS_EXCEPTIONS
   try {
 #    endif // _LIBCPP_HAS_EXCEPTIONS
@@ -1682,9 +1682,9 @@ void packaged_task<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __args) {
 template <class _Rp, class... _ArgTypes>
 void packaged_task<_Rp(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args) {
   if (__p_.__state_ == nullptr)
-    __throw_future_error(future_errc::no_state);
+    std::__throw_future_error(future_errc::no_state);
   if (__p_.__state_->__has_value())
-    __throw_future_error(future_errc::promise_already_satisfied);
+    std::__throw_future_error(future_errc::promise_already_satisfied);
 #    if _LIBCPP_HAS_EXCEPTIONS
   try {
 #    endif // _LIBCPP_HAS_EXCEPTIONS
@@ -1699,7 +1699,7 @@ void packaged_task<_Rp(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __
 template <class _Rp, class... _ArgTypes>
 void packaged_task<_Rp(_ArgTypes...)>::reset() {
   if (!valid())
-    __throw_future_error(future_errc::no_state);
+    std::__throw_future_error(future_errc::no_state);
   __p_ = promise<_Rp>();
 }
 
@@ -1767,9 +1767,9 @@ packaged_task(_Fp) -> packaged_task<_Stripped>;
 template <class... _ArgTypes>
 void packaged_task<void(_ArgTypes...)>::operator()(_ArgTypes... __args) {
   if (__p_.__state_ == nullptr)
-    __throw_future_error(future_errc::no_state);
+    std::__throw_future_error(future_errc::no_state);
   if (__p_.__state_->__has_value())
-    __throw_future_error(future_errc::promise_already_satisfied);
+    std::__throw_future_error(future_errc::promise_already_satisfied);
 #    if _LIBCPP_HAS_EXCEPTIONS
   try {
 #    endif // _LIBCPP_HAS_EXCEPTIONS
@@ -1785,9 +1785,9 @@ void packaged_task<void(_ArgTypes...)>::operator()(_ArgTypes... __args) {
 template <class... _ArgTypes>
 void packaged_task<void(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args) {
   if (__p_.__state_ == nullptr)
-    __throw_future_error(future_errc::no_state);
+    std::__throw_future_error(future_errc::no_state);
   if (__p_.__state_->__has_value())
-    __throw_future_error(future_errc::promise_already_satisfied);
+    std::__throw_future_error(future_errc::promise_already_satisfied);
 #    if _LIBCPP_HAS_EXCEPTIONS
   try {
 #    endif // _LIBCPP_HAS_EXCEPTIONS
@@ -1803,7 +1803,7 @@ void packaged_task<void(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... _
 template <class... _ArgTypes>
 void packaged_task<void(_ArgTypes...)>::reset() {
   if (!valid())
-    __throw_future_error(future_errc::no_state);
+    std::__throw_future_error(future_errc::no_state);
   __p_ = promise<void>();
 }
 
diff --git a/libcxx/include/locale b/libcxx/include/locale
index be0f31cece671..86e327fde5695 100644
--- a/libcxx/include/locale
+++ b/libcxx/include/locale
@@ -292,7 +292,7 @@ _LIBCPP_HIDE_FROM_ABI _ForwardIterator __scan_keyword(
   if (__nkw > sizeof(__statbuf)) {
     __status = (unsigned char*)malloc(__nkw);
     if (__status == nullptr)
-      __throw_bad_alloc();
+      std::__throw_bad_alloc();
     __stat_hold.reset(__status);
   }
   size_t __n_might_match = __nkw; // At this point, any keyword might match
@@ -1324,7 +1324,7 @@ _LIBCPP_HIDE_FROM_ABI inline _OutputIterator num_put<_CharT, _OutputIterator>::_
     else
       __nc = __locale::__asprintf(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v);
     if (__nc == -1)
-      __throw_bad_alloc();
+      std::__throw_bad_alloc();
     __nbh.reset(__nb);
   }
   _LIBCPP_DIAGNOSTIC_POP
@@ -1337,7 +1337,7 @@ _LIBCPP_HIDE_FROM_ABI inline _OutputIterator num_put<_CharT, _OutputIterator>::_
   if (__nb != __nar) {
     __ob = (char_type*)malloc(2 * static_cast<size_t>(__nc) * sizeof(char_type));
     if (__ob == 0)
-      __throw_bad_alloc();
+      std::__throw_bad_alloc();
     __obh.reset(__ob);
   }
   char_type* __op; // pad here
@@ -2382,7 +2382,7 @@ _LIBCPP_HIDE_FROM_ABI void __double_or_nothing(unique_ptr<_Tp, void (*)(void*)>&
   size_t __n_off = static_cast<size_t>(__n - __b.get());
   _Tp* __t       = (_Tp*)std::realloc(__owns ? __b.get() : 0, __new_cap);
   if (__t == 0)
-    __throw_bad_alloc();
+    std::__throw_bad_alloc();
   if (__owns)
     __b.release();
   __b = unique_ptr<_Tp, void (*)(void*)>(__t, free);
@@ -2585,7 +2585,7 @@ _InputIterator money_get<_CharT, _InputIterator>::do_get(
     if (__wn - __wb.get() > __bz - 2) {
       __h.reset((char*)malloc(static_cast<size_t>(__wn - __wb.get() + 2)));
       if (__h.get() == nullptr)
-        __throw_bad_alloc();
+        std::__throw_bad_alloc();
       __nc = __h.get();
     }
     if (__neg)
@@ -2594,7 +2594,7 @@ _InputIterator money_get<_CharT, _InputIterator>::do_get(
       *__nc = __src[std::find(__atoms, std::end(__atoms), *__w) - __atoms];
     *__nc = char();
     if (sscanf(__nbuf, "%Lf", &__v) != 1)
-      __throw_runtime_error("money_get error");
+      std::__throw_runtime_error("money_get error");
   }
   if (__b == __e)
     __err |= ios_base::eofbit;
@@ -2859,11 +2859,11 @@ _OutputIterator money_put<_CharT, _OutputIterator>::do_put(
   if (static_cast<size_t>(__n) > __bs - 1) {
     __n = __locale::__asprintf(&__bb, _LIBCPP_GET_C_LOCALE, "%.0Lf", __units);
     if (__n == -1)
-      __throw_bad_alloc();
+      std::__throw_bad_alloc();
     __hn.reset(__bb);
     __hd.reset((char_type*)malloc(static_cast<size_t>(__n) * sizeof(char_type)));
     if (__hd == nullptr)
-      __throw_bad_alloc();
+      std::__throw_bad_alloc();
     __db = __hd.get();
   }
   // gather info
@@ -2890,7 +2890,7 @@ _OutputIterator money_put<_CharT, _OutputIterator>::do_put(
     __hw.reset((char_type*)malloc(__exn * sizeof(char_type)));
     __mb = __hw.get();
     if (__mb == 0)
-      __throw_bad_alloc();
+      std::__throw_bad_alloc();
   }
   // format
   char_type* __mi;
@@ -2928,7 +2928,7 @@ _OutputIterator money_put<_CharT, _OutputIterator>::do_put(
     __h.reset((char_type*)malloc(__exn * sizeof(char_type)));
     __mb = __h.get();
     if (__mb == 0)
-      __throw_bad_alloc();
+      std::__throw_bad_alloc();
   }
   // format
   char_type* __mi;
@@ -3203,7 +3203,7 @@ wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::from_bytes(const char*
   }
 
   if (__wide_err_string_.empty())
-    __throw_range_error("wstring_convert: from_bytes error");
+    std::__throw_range_error("wstring_convert: from_bytes error");
 
   return __wide_err_string_;
 }
@@ -3272,7 +3272,7 @@ wstring_convert<_Codecvt, _Elem, _WideAlloc, _ByteAlloc>::to_bytes(const _Elem*
   }
 
   if (__byte_err_string_.empty())
-    __throw_range_error("wstring_convert: to_bytes error");
+    std::__throw_range_error("wstring_convert: to_bytes error");
 
   return __byte_err_string_;
 }
diff --git a/libcxx/include/map b/libcxx/include/map
index 76d32ad883d6a..ef920bf11ef2a 100644
--- a/libcxx/include/map
+++ b/libcxx/include/map
@@ -1572,7 +1572,7 @@ _Tp& map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) {
   __parent_pointer __parent;
   __node_base_pointer& __child = __tree_.__find_equal(__parent, __k);
   if (__child == nullptr)
-    __throw_out_of_range("map::at:  key not found");
+    std::__throw_out_of_range("map::at:  key not found");
   return static_cast<__node_pointer>(__child)->__value_.__get_value().second;
 }
 
@@ -1581,7 +1581,7 @@ const _Tp& map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const {
   __parent_pointer __parent;
   __node_base_pointer __child = __tree_.__find_equal(__parent, __k);
   if (__child == nullptr)
-    __throw_out_of_range("map::at:  key not found");
+    std::__throw_out_of_range("map::at:  key not found");
   return static_cast<__node_pointer>(__child)->__value_.__get_value().second;
 }
 
diff --git a/libcxx/include/optional b/libcxx/include/optional
index db236f86e74dd..294c3ddf993fa 100644
--- a/libcxx/include/optional
+++ b/libcxx/include/optional
@@ -827,25 +827,25 @@ public:
 
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr value_type const& value() const& {
     if (!this->has_value())
-      __throw_bad_optional_access();
+      std::__throw_bad_optional_access();
     return this->__get();
   }
 
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr value_type& value() & {
     if (!this->has_value())
-      __throw_bad_optional_access();
+      std::__throw_bad_optional_access();
     return this->__get();
   }
 
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr value_type&& value() && {
     if (!this->has_value())
-      __throw_bad_optional_access();
+      std::__throw_bad_optional_access();
     return std::move(this->__get());
   }
 
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr value_type const&& value() const&& {
     if (!this->has_value())
-      __throw_bad_optional_access();
+      std::__throw_bad_optional_access();
     return std::move(this->__get());
   }
 
diff --git a/libcxx/include/regex b/libcxx/include/regex
index dcee77cfacc3d..36ea55ce30921 100644
--- a/libcxx/include/regex
+++ b/libcxx/include/regex
@@ -1681,7 +1681,7 @@ public:
 template <class _CharT>
 void __back_ref<_CharT>::__exec(__state& __s) const {
   if (__mexp_ > __s.__sub_matches_.size())
-    __throw_regex_error<regex_constants::error_backref>();
+    std::__throw_regex_error<regex_constants::error_backref>();
   sub_match<const _CharT*>& __sm = __s.__sub_matches_[__mexp_ - 1];
   if (__sm.matched) {
     ptrdiff_t __len = __sm.second - __sm.first;
@@ -2117,7 +2117,7 @@ public:
           std::make_pair(__traits_.transform(__b.begin(), __b.end()), __traits_.transform(__e.begin(), __e.end())));
     } else {
       if (__b.size() != 1 || __e.size() != 1)
-        __throw_regex_error<regex_constants::error_range>();
+        std::__throw_regex_error<regex_constants::error_range>();
       if (__icase_) {
         __b[0] = __traits_.translate_nocase(__b[0]);
         __e[0] = __traits_.translate_nocase(__e[0]);
@@ -2743,7 +2743,7 @@ void basic_regex<_CharT, _Traits>::__init(_ForwardIterator __first, _ForwardIter
     __flags_ |= regex_constants::ECMAScript;
   _ForwardIterator __temp = __parse(__first, __last);
   if (__temp != __last)
-    __throw_regex_error<regex_constants::__re_err_parse>();
+    std::__throw_regex_error<regex_constants::__re_err_parse>();
 }
 
 template <class _CharT, class _Traits>
@@ -2773,7 +2773,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse(_ForwardIterator __first,
     __first = __parse_egrep(__first, __last);
     break;
   default:
-    __throw_regex_error<regex_constants::__re_err_grammar>();
+    std::__throw_regex_error<regex_constants::__re_err_grammar>();
   }
   return __first;
 }
@@ -2798,7 +2798,7 @@ basic_regex<_CharT, _Traits>::__parse_basic_reg_exp(_ForwardIterator __first, _F
       }
     }
     if (__first != __last)
-      __throw_regex_error<regex_constants::__re_err_empty>();
+      std::__throw_regex_error<regex_constants::__re_err_empty>();
   }
   return __first;
 }
@@ -2810,13 +2810,13 @@ basic_regex<_CharT, _Traits>::__parse_extended_reg_exp(_ForwardIterator __first,
   __owns_one_state<_CharT>* __sa = __end_;
   _ForwardIterator __temp        = __parse_ERE_branch(__first, __last);
   if (__temp == __first)
-    __throw_regex_error<regex_constants::__re_err_empty>();
+    std::__throw_regex_error<regex_constants::__re_err_empty>();
   __first = __temp;
   while (__first != __last && *__first == '|') {
     __owns_one_state<_CharT>* __sb = __end_;
     __temp                         = __parse_ERE_branch(++__first, __last);
     if (__temp == __first)
-      __throw_regex_error<regex_constants::__re_err_empty>();
+      std::__throw_regex_error<regex_constants::__re_err_empty>();
     __push_alternation(__sa, __sb);
     __first = __temp;
   }
@@ -2828,7 +2828,7 @@ template <class _ForwardIterator>
 _ForwardIterator basic_regex<_CharT, _Traits>::__parse_ERE_branch(_ForwardIterator __first, _ForwardIterator __last) {
   _ForwardIterator __temp = __parse_ERE_expression(__first, __last);
   if (__temp == __first)
-    __throw_regex_error<regex_constants::__re_err_empty>();
+    std::__throw_regex_error<regex_constants::__re_err_empty>();
   do {
     __first = __temp;
     __temp  = __parse_ERE_expression(__first, __last);
@@ -2859,7 +2859,7 @@ basic_regex<_CharT, _Traits>::__parse_ERE_expression(_ForwardIterator __first, _
       ++__open_count_;
       __temp = __parse_extended_reg_exp(++__temp, __last);
       if (__temp == __last || *__temp != ')')
-        __throw_regex_error<regex_constants::error_paren>();
+        std::__throw_regex_error<regex_constants::error_paren>();
       __push_end_marked_subexpression(__temp_count);
       --__open_count_;
       ++__temp;
@@ -2911,7 +2911,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_nondupl_RE(_ForwardIterat
       __first               = __parse_RE_expression(__temp, __last);
       __temp                = __parse_Back_close_paren(__first, __last);
       if (__temp == __first)
-        __throw_regex_error<regex_constants::error_paren>();
+        std::__throw_regex_error<regex_constants::error_paren>();
       __push_end_marked_subexpression(__temp_count);
       __first = __temp;
     } else
@@ -3154,14 +3154,14 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_RE_dupl_symbol(
         __first   = __temp;
         __temp    = __parse_DUP_COUNT(__first, __last, __min);
         if (__temp == __first)
-          __throw_regex_error<regex_constants::error_badbrace>();
+          std::__throw_regex_error<regex_constants::error_badbrace>();
         __first = __temp;
         if (__first == __last)
-          __throw_regex_error<regex_constants::error_brace>();
+          std::__throw_regex_error<regex_constants::error_brace>();
         if (*__first != ',') {
           __temp = __parse_Back_close_brace(__first, __last);
           if (__temp == __first)
-            __throw_regex_error<regex_constants::error_brace>();
+            std::__throw_regex_error<regex_constants::error_brace>();
           __push_loop(__min, __min, __s, __mexp_begin, __mexp_end, true);
           __first = __temp;
         } else {
@@ -3170,12 +3170,12 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_RE_dupl_symbol(
           __first   = __parse_DUP_COUNT(__first, __last, __max);
           __temp    = __parse_Back_close_brace(__first, __last);
           if (__temp == __first)
-            __throw_regex_error<regex_constants::error_brace>();
+            std::__throw_regex_error<regex_constants::error_brace>();
           if (__max == -1)
             __push_greedy_inf_repeat(__min, __s, __mexp_begin, __mexp_end);
           else {
             if (__max < __min)
-              __throw_regex_error<regex_constants::error_badbrace>();
+              std::__throw_regex_error<regex_constants::error_badbrace>();
             __push_loop(__min, __max, __s, __mexp_begin, __mexp_end, true);
           }
           __first = __temp;
@@ -3225,10 +3225,10 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_ERE_dupl_symbol(
       int __min;
       _ForwardIterator __temp = __parse_DUP_COUNT(++__first, __last, __min);
       if (__temp == __first)
-        __throw_regex_error<regex_constants::error_badbrace>();
+        std::__throw_regex_error<regex_constants::error_badbrace>();
       __first = __temp;
       if (__first == __last)
-        __throw_regex_error<regex_constants::error_brace>();
+        std::__throw_regex_error<regex_constants::error_brace>();
       switch (*__first) {
       case '}':
         ++__first;
@@ -3241,7 +3241,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_ERE_dupl_symbol(
       case ',':
         ++__first;
         if (__first == __last)
-          __throw_regex_error<regex_constants::error_badbrace>();
+          std::__throw_regex_error<regex_constants::error_badbrace>();
         if (*__first == '}') {
           ++__first;
           if (__grammar == ECMAScript && __first != __last && *__first == '?') {
@@ -3253,13 +3253,13 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_ERE_dupl_symbol(
           int __max = -1;
           __temp    = __parse_DUP_COUNT(__first, __last, __max);
           if (__temp == __first)
-            __throw_regex_error<regex_constants::error_brace>();
+            std::__throw_regex_error<regex_constants::error_brace>();
           __first = __temp;
           if (__first == __last || *__first != '}')
-            __throw_regex_error<regex_constants::error_brace>();
+            std::__throw_regex_error<regex_constants::error_brace>();
           ++__first;
           if (__max < __min)
-            __throw_regex_error<regex_constants::error_badbrace>();
+            std::__throw_regex_error<regex_constants::error_badbrace>();
           if (__grammar == ECMAScript && __first != __last && *__first == '?') {
             ++__first;
             __push_loop(__min, __max, __s, __mexp_begin, __mexp_end, false);
@@ -3268,7 +3268,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_ERE_dupl_symbol(
         }
         break;
       default:
-        __throw_regex_error<regex_constants::error_badbrace>();
+        std::__throw_regex_error<regex_constants::error_badbrace>();
       }
     } break;
     }
@@ -3283,7 +3283,7 @@ basic_regex<_CharT, _Traits>::__parse_bracket_expression(_ForwardIterator __firs
   if (__first != __last && *__first == '[') {
     ++__first;
     if (__first == __last)
-      __throw_regex_error<regex_constants::error_brack>();
+      std::__throw_regex_error<regex_constants::error_brack>();
     bool __negate = false;
     if (*__first == '^') {
       ++__first;
@@ -3292,20 +3292,20 @@ basic_regex<_CharT, _Traits>::__parse_bracket_expression(_ForwardIterator __firs
     __bracket_expression<_CharT, _Traits>* __ml = __start_matching_list(__negate);
     // __ml owned by *this
     if (__first == __last)
-      __throw_regex_error<regex_constants::error_brack>();
+      std::__throw_regex_error<regex_constants::error_brack>();
     if (__get_grammar(__flags_) != ECMAScript && *__first == ']') {
       __ml->__add_char(']');
       ++__first;
     }
     __first = __parse_follow_list(__first, __last, __ml);
     if (__first == __last)
-      __throw_regex_error<regex_constants::error_brack>();
+      std::__throw_regex_error<regex_constants::error_brack>();
     if (*__first == '-') {
       __ml->__add_char('-');
       ++__first;
     }
     if (__first == __last || *__first != ']')
-      __throw_regex_error<regex_constants::error_brack>();
+      std::__throw_regex_error<regex_constants::error_brack>();
     ++__first;
   }
   return __first;
@@ -3398,7 +3398,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_class_escape(
     basic_string<_CharT>& __str,
     __bracket_expression<_CharT, _Traits>* __ml) {
   if (__first == __last)
-    __throw_regex_error<regex_constants::error_escape>();
+    std::__throw_regex_error<regex_constants::error_escape>();
   switch (*__first) {
   case 0:
     __str = *__first;
@@ -3436,7 +3436,7 @@ template <class _ForwardIterator>
 _ForwardIterator basic_regex<_CharT, _Traits>::__parse_awk_escape(
     _ForwardIterator __first, _ForwardIterator __last, basic_string<_CharT>* __str) {
   if (__first == __last)
-    __throw_regex_error<regex_constants::error_escape>();
+    std::__throw_regex_error<regex_constants::error_escape>();
   switch (*__first) {
   case '\\':
   case '"':
@@ -3501,7 +3501,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_awk_escape(
     else
       __push_char(_CharT(__val));
   } else
-    __throw_regex_error<regex_constants::error_escape>();
+    std::__throw_regex_error<regex_constants::error_escape>();
   return __first;
 }
 
@@ -3514,11 +3514,11 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_equivalence_class(
   value_type __equal_close[2] = {'=', ']'};
   _ForwardIterator __temp     = std::search(__first, __last, __equal_close, __equal_close + 2);
   if (__temp == __last)
-    __throw_regex_error<regex_constants::error_brack>();
+    std::__throw_regex_error<regex_constants::error_brack>();
   // [__first, __temp) contains all text in [= ... =]
   string_type __collate_name = __traits_.lookup_collatename(__first, __temp);
   if (__collate_name.empty())
-    __throw_regex_error<regex_constants::error_collate>();
+    std::__throw_regex_error<regex_constants::error_collate>();
   string_type __equiv_name = __traits_.transform_primary(__collate_name.begin(), __collate_name.end());
   if (!__equiv_name.empty())
     __ml->__add_equivalence(__equiv_name);
@@ -3531,7 +3531,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_equivalence_class(
       __ml->__add_digraph(__collate_name[0], __collate_name[1]);
       break;
     default:
-      __throw_regex_error<regex_constants::error_collate>();
+      std::__throw_regex_error<regex_constants::error_collate>();
     }
   }
   __first = std::next(__temp, 2);
@@ -3547,12 +3547,12 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_character_class(
   value_type __colon_close[2] = {':', ']'};
   _ForwardIterator __temp     = std::search(__first, __last, __colon_close, __colon_close + 2);
   if (__temp == __last)
-    __throw_regex_error<regex_constants::error_brack>();
+    std::__throw_regex_error<regex_constants::error_brack>();
   // [__first, __temp) contains all text in [: ... :]
   typedef typename _Traits::char_class_type char_class_type;
   char_class_type __class_type = __traits_.lookup_classname(__first, __temp, __flags_ & icase);
   if (__class_type == 0)
-    __throw_regex_error<regex_constants::error_ctype>();
+    std::__throw_regex_error<regex_constants::error_ctype>();
   __ml->__add_class(__class_type);
   __first = std::next(__temp, 2);
   return __first;
@@ -3567,7 +3567,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_collating_symbol(
   value_type __dot_close[2] = {'.', ']'};
   _ForwardIterator __temp   = std::search(__first, __last, __dot_close, __dot_close + 2);
   if (__temp == __last)
-    __throw_regex_error<regex_constants::error_brack>();
+    std::__throw_regex_error<regex_constants::error_brack>();
   // [__first, __temp) contains all text in [. ... .]
   __col_sym = __traits_.lookup_collatename(__first, __temp);
   switch (__col_sym.size()) {
@@ -3575,7 +3575,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_collating_symbol(
   case 2:
     break;
   default:
-    __throw_regex_error<regex_constants::error_collate>();
+    std::__throw_regex_error<regex_constants::error_collate>();
   }
   __first = std::next(__temp, 2);
   return __first;
@@ -3591,7 +3591,7 @@ basic_regex<_CharT, _Traits>::__parse_DUP_COUNT(_ForwardIterator __first, _Forwa
       __c = __val;
       for (++__first; __first != __last && (__val = __traits_.value(*__first, 10)) != -1; ++__first) {
         if (__c >= numeric_limits<int>::max() / 10)
-          __throw_regex_error<regex_constants::error_badbrace>();
+          std::__throw_regex_error<regex_constants::error_badbrace>();
         __c *= 10;
         __c += __val;
       }
@@ -3684,7 +3684,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_assertion(_ForwardIterato
             __push_lookahead(std::move(__exp), false, __marked_count_);
             __marked_count_ += __mexp;
             if (__temp == __last || *__temp != ')')
-              __throw_regex_error<regex_constants::error_paren>();
+              std::__throw_regex_error<regex_constants::error_paren>();
             __first = ++__temp;
           } break;
           case '!': {
@@ -3695,7 +3695,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_assertion(_ForwardIterato
             __push_lookahead(std::move(__exp), true, __marked_count_);
             __marked_count_ += __mexp;
             if (__temp == __last || *__temp != ')')
-              __throw_regex_error<regex_constants::error_paren>();
+              std::__throw_regex_error<regex_constants::error_paren>();
             __first = ++__temp;
           } break;
           }
@@ -3725,13 +3725,13 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_atom(_ForwardIterator __f
     case '(': {
       ++__first;
       if (__first == __last)
-        __throw_regex_error<regex_constants::error_paren>();
+        std::__throw_regex_error<regex_constants::error_paren>();
       _ForwardIterator __temp = std::next(__first);
       if (__temp != __last && *__first == '?' && *__temp == ':') {
         ++__open_count_;
         __first = __parse_ecma_exp(++__temp, __last);
         if (__first == __last || *__first != ')')
-          __throw_regex_error<regex_constants::error_paren>();
+          std::__throw_regex_error<regex_constants::error_paren>();
         --__open_count_;
         ++__first;
       } else {
@@ -3740,7 +3740,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_atom(_ForwardIterator __f
         ++__open_count_;
         __first = __parse_ecma_exp(__first, __last);
         if (__first == __last || *__first != ')')
-          __throw_regex_error<regex_constants::error_paren>();
+          std::__throw_regex_error<regex_constants::error_paren>();
         __push_end_marked_subexpression(__temp_count);
         --__open_count_;
         ++__first;
@@ -3750,7 +3750,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_atom(_ForwardIterator __f
     case '+':
     case '?':
     case '{':
-      __throw_regex_error<regex_constants::error_badrepeat>();
+      std::__throw_regex_error<regex_constants::error_badrepeat>();
       break;
     default:
       __first = __parse_pattern_character(__first, __last);
@@ -3766,7 +3766,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_atom_escape(_ForwardItera
   if (__first != __last && *__first == '\\') {
     _ForwardIterator __t1 = std::next(__first);
     if (__t1 == __last)
-      __throw_regex_error<regex_constants::error_escape>();
+      std::__throw_regex_error<regex_constants::error_escape>();
 
     _ForwardIterator __t2 = __parse_decimal_escape(__t1, __last);
     if (__t2 != __t1)
@@ -3797,11 +3797,11 @@ basic_regex<_CharT, _Traits>::__parse_decimal_escape(_ForwardIterator __first, _
       unsigned __v = *__first - '0';
       for (++__first; __first != __last && '0' <= *__first && *__first <= '9'; ++__first) {
         if (__v >= numeric_limits<unsigned>::max() / 10)
-          __throw_regex_error<regex_constants::error_backref>();
+          std::__throw_regex_error<regex_constants::error_backref>();
         __v = 10 * __v + *__first - '0';
       }
       if (__v == 0 || __v > mark_count())
-        __throw_regex_error<regex_constants::error_backref>();
+        std::__throw_regex_error<regex_constants::error_backref>();
       __push_back_ref(__v);
     }
   }
@@ -3905,40 +3905,40 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_character_escape(
             __push_char(_CharT(*__t % 32));
           __first = ++__t;
         } else
-          __throw_regex_error<regex_constants::error_escape>();
+          std::__throw_regex_error<regex_constants::error_escape>();
       } else
-        __throw_regex_error<regex_constants::error_escape>();
+        std::__throw_regex_error<regex_constants::error_escape>();
       break;
     case 'u':
       ++__first;
       if (__first == __last)
-        __throw_regex_error<regex_constants::error_escape>();
+        std::__throw_regex_error<regex_constants::error_escape>();
       __hd = __traits_.value(*__first, 16);
       if (__hd == -1)
-        __throw_regex_error<regex_constants::error_escape>();
+        std::__throw_regex_error<regex_constants::error_escape>();
       __sum = 16 * __sum + static_cast<unsigned>(__hd);
       ++__first;
       if (__first == __last)
-        __throw_regex_error<regex_constants::error_escape>();
+        std::__throw_regex_error<regex_constants::error_escape>();
       __hd = __traits_.value(*__first, 16);
       if (__hd == -1)
-        __throw_regex_error<regex_constants::error_escape>();
+        std::__throw_regex_error<regex_constants::error_escape>();
       __sum = 16 * __sum + static_cast<unsigned>(__hd);
       _LIBCPP_FALLTHROUGH();
     case 'x':
       ++__first;
       if (__first == __last)
-        __throw_regex_error<regex_constants::error_escape>();
+        std::__throw_regex_error<regex_constants::error_escape>();
       __hd = __traits_.value(*__first, 16);
       if (__hd == -1)
-        __throw_regex_error<regex_constants::error_escape>();
+        std::__throw_regex_error<regex_constants::error_escape>();
       __sum = 16 * __sum + static_cast<unsigned>(__hd);
       ++__first;
       if (__first == __last)
-        __throw_regex_error<regex_constants::error_escape>();
+        std::__throw_regex_error<regex_constants::error_escape>();
       __hd = __traits_.value(*__first, 16);
       if (__hd == -1)
-        __throw_regex_error<regex_constants::error_escape>();
+        std::__throw_regex_error<regex_constants::error_escape>();
       __sum = 16 * __sum + static_cast<unsigned>(__hd);
       if (__str)
         *__str = _CharT(__sum);
@@ -3961,7 +3961,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_character_escape(
           __push_char(*__first);
         ++__first;
       } else
-        __throw_regex_error<regex_constants::error_escape>();
+        std::__throw_regex_error<regex_constants::error_escape>();
       break;
     }
   }
@@ -4057,7 +4057,7 @@ bool basic_regex<_CharT, _Traits>::__test_back_ref(_CharT __c) {
   unsigned __val = __traits_.value(__c, 10);
   if (__val >= 1 && __val <= 9) {
     if (__val > mark_count())
-      __throw_regex_error<regex_constants::error_backref>();
+      std::__throw_regex_error<regex_constants::error_backref>();
     __push_back_ref(__val);
     return true;
   }
@@ -4778,7 +4778,7 @@ _OutputIter match_results<_BidirectionalIterator, _Allocator>::format(
             if (__fmt_first + 1 != __fmt_last && '0' <= __fmt_first[1] && __fmt_first[1] <= '9') {
               ++__fmt_first;
               if (__idx >= numeric_limits<size_t>::max() / 10)
-                __throw_regex_error<regex_constants::error_escape>();
+                std::__throw_regex_error<regex_constants::error_escape>();
               __idx = 10 * __idx + *__fmt_first - '0';
             }
             __output_iter = std::copy((*this)[__idx].first, (*this)[__idx].second, __output_iter);
@@ -4865,7 +4865,7 @@ bool basic_regex<_CharT, _Traits>::__match_at_start_ecma(
     do {
       ++__counter;
       if (__counter % _LIBCPP_REGEX_COMPLEXITY_FACTOR == 0 && __counter / _LIBCPP_REGEX_COMPLEXITY_FACTOR >= __length)
-        __throw_regex_error<regex_constants::error_complexity>();
+        std::__throw_regex_error<regex_constants::error_complexity>();
       __state& __s = __states.back();
       if (__s.__node_)
         __s.__node_->__exec(__s);
@@ -4899,7 +4899,7 @@ bool basic_regex<_CharT, _Traits>::__match_at_start_ecma(
         __states.pop_back();
         break;
       default:
-        __throw_regex_error<regex_constants::__re_err_unknown>();
+        std::__throw_regex_error<regex_constants::__re_err_unknown>();
         break;
       }
     } while (!__states.empty());
@@ -4935,7 +4935,7 @@ bool basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs(
     do {
       ++__counter;
       if (__counter % _LIBCPP_REGEX_COMPLEXITY_FACTOR == 0 && __counter / _LIBCPP_REGEX_COMPLEXITY_FACTOR >= __length)
-        __throw_regex_error<regex_constants::error_complexity>();
+        std::__throw_regex_error<regex_constants::error_complexity>();
       __state& __s = __states.back();
       if (__s.__node_)
         __s.__node_->__exec(__s);
@@ -4976,7 +4976,7 @@ bool basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs(
         __states.pop_back();
         break;
       default:
-        __throw_regex_error<regex_constants::__re_err_unknown>();
+        std::__throw_regex_error<regex_constants::__re_err_unknown>();
         break;
       }
     } while (!__states.empty());
@@ -5025,7 +5025,7 @@ bool basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(
     do {
       ++__counter;
       if (__counter % _LIBCPP_REGEX_COMPLEXITY_FACTOR == 0 && __counter / _LIBCPP_REGEX_COMPLEXITY_FACTOR >= __length)
-        __throw_regex_error<regex_constants::error_complexity>();
+        std::__throw_regex_error<regex_constants::error_complexity>();
       __state& __s = __states.back();
       if (__s.__node_)
         __s.__node_->__exec(__s);
@@ -5063,7 +5063,7 @@ bool basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(
         __states.pop_back();
         break;
       default:
-        __throw_regex_error<regex_constants::__re_err_unknown>();
+        std::__throw_regex_error<regex_constants::__re_err_unknown>();
         break;
       }
     } while (!__states.empty());
diff --git a/libcxx/include/shared_mutex b/libcxx/include/shared_mutex
index 6738efeedb3c2..b1e2a5d434400 100644
--- a/libcxx/include/shared_mutex
+++ b/libcxx/include/shared_mutex
@@ -400,9 +400,9 @@ _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(shared_lock);
 template <class _Mutex>
 void shared_lock<_Mutex>::lock() {
   if (__m_ == nullptr)
-    __throw_system_error(EPERM, "shared_lock::lock: references null mutex");
+    std::__throw_system_error(EPERM, "shared_lock::lock: references null mutex");
   if (__owns_)
-    __throw_system_error(EDEADLK, "shared_lock::lock: already locked");
+    std::__throw_system_error(EDEADLK, "shared_lock::lock: already locked");
   __m_->lock_shared();
   __owns_ = true;
 }
@@ -410,9 +410,9 @@ void shared_lock<_Mutex>::lock() {
 template <class _Mutex>
 bool shared_lock<_Mutex>::try_lock() {
   if (__m_ == nullptr)
-    __throw_system_error(EPERM, "shared_lock::try_lock: references null mutex");
+    std::__throw_system_error(EPERM, "shared_lock::try_lock: references null mutex");
   if (__owns_)
-    __throw_system_error(EDEADLK, "shared_lock::try_lock: already locked");
+    std::__throw_system_error(EDEADLK, "shared_lock::try_lock: already locked");
   __owns_ = __m_->try_lock_shared();
   return __owns_;
 }
@@ -421,9 +421,9 @@ template <class _Mutex>
 template <class _Rep, class _Period>
 bool shared_lock<_Mutex>::try_lock_for(const chrono::duration<_Rep, _Period>& __d) {
   if (__m_ == nullptr)
-    __throw_system_error(EPERM, "shared_lock::try_lock_for: references null mutex");
+    std::__throw_system_error(EPERM, "shared_lock::try_lock_for: references null mutex");
   if (__owns_)
-    __throw_system_error(EDEADLK, "shared_lock::try_lock_for: already locked");
+    std::__throw_system_error(EDEADLK, "shared_lock::try_lock_for: already locked");
   __owns_ = __m_->try_lock_shared_for(__d);
   return __owns_;
 }
@@ -432,9 +432,9 @@ template <class _Mutex>
 template <class _Clock, class _Duration>
 bool shared_lock<_Mutex>::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t) {
   if (__m_ == nullptr)
-    __throw_system_error(EPERM, "shared_lock::try_lock_until: references null mutex");
+    std::__throw_system_error(EPERM, "shared_lock::try_lock_until: references null mutex");
   if (__owns_)
-    __throw_system_error(EDEADLK, "shared_lock::try_lock_until: already locked");
+    std::__throw_system_error(EDEADLK, "shared_lock::try_lock_until: already locked");
   __owns_ = __m_->try_lock_shared_until(__t);
   return __owns_;
 }
@@ -442,7 +442,7 @@ bool shared_lock<_Mutex>::try_lock_until(const chrono::time_point<_Clock, _Durat
 template <class _Mutex>
 void shared_lock<_Mutex>::unlock() {
   if (!__owns_)
-    __throw_system_error(EPERM, "shared_lock::unlock: not locked");
+    std::__throw_system_error(EPERM, "shared_lock::unlock: not locked");
   __m_->unlock_shared();
   __owns_ = false;
 }
diff --git a/libcxx/include/string b/libcxx/include/string
index 396e73522d3e7..f78988f00fc06 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -946,7 +946,7 @@ private:
       __uninitialized_size_tag, size_type __size, const allocator_type& __a)
       : __alloc_(__a) {
     if (__size > max_size())
-      __throw_length_error();
+      this->__throw_length_error();
     if (__fits_in_sso(__size)) {
       __rep_ = __rep();
       __set_short_size(__size);
@@ -1115,7 +1115,7 @@ public:
       basic_string&& __str, size_type __pos, size_type __n, const _Allocator& __alloc = _Allocator())
       : __alloc_(__alloc) {
     if (__pos > __str.size())
-      __throw_out_of_range();
+      this->__throw_out_of_range();
 
     auto __len = std::min<size_type>(__n, __str.size() - __pos);
     if (__alloc_traits::is_always_equal::value || __alloc == __str.__alloc_) {
@@ -1138,7 +1138,7 @@ public:
       : __alloc_(__a) {
     size_type __str_sz = __str.size();
     if (__pos > __str_sz)
-      __throw_out_of_range();
+      this->__throw_out_of_range();
     __init(__str.data() + __pos, std::min(__n, __str_sz - __pos));
   }
 
@@ -1147,7 +1147,7 @@ public:
       : __alloc_(__a) {
     size_type __str_sz = __str.size();
     if (__pos > __str_sz)
-      __throw_out_of_range();
+      this->__throw_out_of_range();
     __init(__str.data() + __pos, __str_sz - __pos);
   }
 
@@ -2501,7 +2501,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_ty
   if (__libcpp_is_constant_evaluated())
     __rep_ = __rep();
   if (__sz > max_size())
-    __throw_length_error();
+    this->__throw_length_error();
   pointer __p;
   if (__fits_in_sso(__sz)) {
     __set_short_size(__sz);
@@ -2531,7 +2531,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init_copy_ctor_external(const value
     __set_short_size(__sz);
   } else {
     if (__sz > max_size())
-      __throw_length_error();
+      this->__throw_length_error();
     auto __allocation = std::__allocate_at_least(__alloc_, __recommend(__sz) + 1);
     __p               = __allocation.ptr;
     __begin_lifetime(__p, __allocation.count);
@@ -2549,7 +2549,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__
     __rep_ = __rep();
 
   if (__n > max_size())
-    __throw_length_error();
+    this->__throw_length_error();
   pointer __p;
   if (__fits_in_sso(__n)) {
     __set_short_size(__n);
@@ -2612,7 +2612,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init_with_size(_InputIterator __fir
     __rep_ = __rep();
 
   if (__sz > max_size())
-    __throw_length_error();
+    this->__throw_length_error();
 
   pointer __p;
   if (__fits_in_sso(__sz)) {
@@ -2654,7 +2654,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__
     const value_type* __p_new_stuff) {
   size_type __ms = max_size();
   if (__delta_cap > __ms - __old_cap - 1)
-    __throw_length_error();
+    this->__throw_length_error();
   pointer __old_p = __get_pointer();
   size_type __cap =
       __old_cap < __ms / 2 - __alignment ? __recommend(std::max(__old_cap + __delta_cap, 2 * __old_cap)) : __ms - 1;
@@ -2697,7 +2697,7 @@ _LIBCPP_DEPRECATED_("use __grow_by_without_replace") basic_string<_CharT, _Trait
     size_type __n_add) {
   size_type __ms = max_size();
   if (__delta_cap > __ms - __old_cap)
-    __throw_length_error();
+    this->__throw_length_error();
   pointer __old_p = __get_pointer();
   size_type __cap =
       __old_cap < __ms / 2 - __alignment ? __recommend(std::max(__old_cap + __delta_cap, 2 * __old_cap)) : __ms - 1;
@@ -2967,7 +2967,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
 basic_string<_CharT, _Traits, _Allocator>::assign(const basic_string& __str, size_type __pos, size_type __n) {
   size_type __sz = __str.size();
   if (__pos > __sz)
-    __throw_out_of_range();
+    this->__throw_out_of_range();
   return assign(__str.data() + __pos, std::min(__n, __sz - __pos));
 }
 
@@ -2981,7 +2981,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(const _Tp& __t, size_type __po
   __self_view __sv = __t;
   size_type __sz   = __sv.size();
   if (__pos > __sz)
-    __throw_out_of_range();
+    this->__throw_out_of_range();
   return assign(__sv.data() + __pos, std::min(__n, __sz - __pos));
 }
 
@@ -3114,7 +3114,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
 basic_string<_CharT, _Traits, _Allocator>::append(const basic_string& __str, size_type __pos, size_type __n) {
   size_type __sz = __str.size();
   if (__pos > __sz)
-    __throw_out_of_range();
+    this->__throw_out_of_range();
   return append(__str.data() + __pos, std::min(__n, __sz - __pos));
 }
 
@@ -3128,7 +3128,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(const _Tp& __t, size_type __po
   __self_view __sv = __t;
   size_type __sz   = __sv.size();
   if (__pos > __sz)
-    __throw_out_of_range();
+    this->__throw_out_of_range();
   return append(__sv.data() + __pos, std::min(__n, __sz - __pos));
 }
 
@@ -3147,7 +3147,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_t
   _LIBCPP_ASSERT_NON_NULL(__n == 0 || __s != nullptr, "string::insert received nullptr");
   size_type __sz = size();
   if (__pos > __sz)
-    __throw_out_of_range();
+    this->__throw_out_of_range();
   size_type __cap = capacity();
   if (__cap - __sz >= __n) {
     if (__n) {
@@ -3174,7 +3174,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
 basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, size_type __n, value_type __c) {
   size_type __sz = size();
   if (__pos > __sz)
-    __throw_out_of_range();
+    this->__throw_out_of_range();
   if (__n) {
     size_type __cap = capacity();
     value_type* __p;
@@ -3236,7 +3236,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(
     size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n) {
   size_type __str_sz = __str.size();
   if (__pos2 > __str_sz)
-    __throw_out_of_range();
+    this->__throw_out_of_range();
   return insert(__pos1, __str.data() + __pos2, std::min(__n, __str_sz - __pos2));
 }
 
@@ -3250,7 +3250,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const _Tp& _
   __self_view __sv   = __t;
   size_type __str_sz = __sv.size();
   if (__pos2 > __str_sz)
-    __throw_out_of_range();
+    this->__throw_out_of_range();
   return insert(__pos1, __sv.data() + __pos2, std::min(__n, __str_sz - __pos2));
 }
 
@@ -3294,7 +3294,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(
   _LIBCPP_ASSERT_NON_NULL(__n2 == 0 || __s != nullptr, "string::replace received nullptr");
   size_type __sz = size();
   if (__pos > __sz)
-    __throw_out_of_range();
+    this->__throw_out_of_range();
   __n1            = std::min(__n1, __sz - __pos);
   size_type __cap = capacity();
   if (__cap - __sz + __n1 >= __n2) {
@@ -3336,7 +3336,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
 basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, size_type __n2, value_type __c) {
   size_type __sz = size();
   if (__pos > __sz)
-    __throw_out_of_range();
+    this->__throw_out_of_range();
   __n1            = std::min(__n1, __sz - __pos);
   size_type __cap = capacity();
   value_type* __p;
@@ -3372,7 +3372,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(
     size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) {
   size_type __str_sz = __str.size();
   if (__pos2 > __str_sz)
-    __throw_out_of_range();
+    this->__throw_out_of_range();
   return replace(__pos1, __n1, __str.data() + __pos2, std::min(__n2, __str_sz - __pos2));
 }
 
@@ -3387,7 +3387,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(
   __self_view __sv   = __t;
   size_type __str_sz = __sv.size();
   if (__pos2 > __str_sz)
-    __throw_out_of_range();
+    this->__throw_out_of_range();
   return replace(__pos1, __n1, __sv.data() + __pos2, std::min(__n2, __str_sz - __pos2));
 }
 
@@ -3420,7 +3420,7 @@ template <class _CharT, class _Traits, class _Allocator>
 _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
 basic_string<_CharT, _Traits, _Allocator>::erase(size_type __pos, size_type __n) {
   if (__pos > size())
-    __throw_out_of_range();
+    this->__throw_out_of_range();
   if (__n == npos) {
     __erase_to_end(__pos);
   } else {
@@ -3491,7 +3491,7 @@ basic_string<_CharT, _Traits, _Allocator>::__resize_default_init(size_type __n)
 template <class _CharT, class _Traits, class _Allocator>
 _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __requested_capacity) {
   if (__requested_capacity > max_size())
-    __throw_length_error();
+    this->__throw_length_error();
 
   // Make sure reserve(n) never shrinks. This is technically only required in C++20
   // and later (since P0966R1), however we provide consistent behavior in all Standard
@@ -3563,7 +3563,7 @@ template <class _CharT, class _Traits, class _Allocator>
 _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::const_reference
 basic_string<_CharT, _Traits, _Allocator>::at(size_type __n) const {
   if (__n >= size())
-    __throw_out_of_range();
+    this->__throw_out_of_range();
   return (*this)[__n];
 }
 
@@ -3571,7 +3571,7 @@ template <class _CharT, class _Traits, class _Allocator>
 _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::reference
 basic_string<_CharT, _Traits, _Allocator>::at(size_type __n) {
   if (__n >= size())
-    __throw_out_of_range();
+    this->__throw_out_of_range();
   return (*this)[__n];
 }
 
@@ -3580,7 +3580,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>
 basic_string<_CharT, _Traits, _Allocator>::copy(value_type* __s, size_type __n, size_type __pos) const {
   size_type __sz = size();
   if (__pos > __sz)
-    __throw_out_of_range();
+    this->__throw_out_of_range();
   size_type __rlen = std::min(__n, __sz - __pos);
   traits_type::copy(__s, data() + __pos, __rlen);
   return __rlen;
@@ -3634,7 +3634,7 @@ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 int basic_string<_CharT, _Traits, _Allocato
   _LIBCPP_ASSERT_NON_NULL(__n2 == 0 || __s != nullptr, "string::compare(): received nullptr");
   size_type __sz = size();
   if (__pos1 > __sz || __n2 == npos)
-    __throw_out_of_range();
+    this->__throw_out_of_range();
   size_type __rlen = std::min(__n1, __sz - __pos1);
   int __r          = traits_type::compare(data() + __pos1, __s, std::min(__rlen, __n2));
   if (__r == 0) {
diff --git a/libcxx/include/string_view b/libcxx/include/string_view
index e79746318cfa6..c640ae4e79865 100644
--- a/libcxx/include/string_view
+++ b/libcxx/include/string_view
@@ -447,7 +447,7 @@ public:
   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
   copy(_CharT* __s, size_type __n, size_type __pos = 0) const {
     if (__pos > size())
-      __throw_out_of_range("string_view::copy");
+      std::__throw_out_of_range("string_view::copy");
     size_type __rlen = std::min(__n, size() - __pos);
     _Traits::copy(__s, data() + __pos, __rlen);
     return __rlen;
diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map
index 76623d0242752..be36b65cb85b4 100644
--- a/libcxx/include/unordered_map
+++ b/libcxx/include/unordered_map
@@ -1784,7 +1784,7 @@ template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
 _Tp& unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k) {
   iterator __i = find(__k);
   if (__i == end())
-    __throw_out_of_range("unordered_map::at: key not found");
+    std::__throw_out_of_range("unordered_map::at: key not found");
   return __i->second;
 }
 
@@ -1792,7 +1792,7 @@ template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
 const _Tp& unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k) const {
   const_iterator __i = find(__k);
   if (__i == end())
-    __throw_out_of_range("unordered_map::at: key not found");
+    std::__throw_out_of_range("unordered_map::at: key not found");
   return __i->second;
 }
 
diff --git a/libcxx/include/variant b/libcxx/include/variant
index 3786d9524020b..ccb33affc799b 100644
--- a/libcxx/include/variant
+++ b/libcxx/include/variant
@@ -1341,7 +1341,7 @@ template <size_t _Ip, class _Vp>
 _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr auto&& __generic_get(_Vp&& __v) {
   using __variant_detail::__access::__variant;
   if (!std::__holds_alternative<_Ip>(__v)) {
-    __throw_bad_variant_access();
+    std::__throw_bad_variant_access();
   }
   return __variant::__get_alt<_Ip>(std::forward<_Vp>(__v)).__value;
 }
@@ -1554,7 +1554,7 @@ template <class... _Vs>
 _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS constexpr void __throw_if_valueless(_Vs&&... __vs) {
   const bool __valueless = (... || std::__as_variant(__vs).valueless_by_exception());
   if (__valueless) {
-    __throw_bad_variant_access();
+    std::__throw_bad_variant_access();
   }
 }
 
diff --git a/libcxx/src/chrono.cpp b/libcxx/src/chrono.cpp
index dbc0f617b4fc6..20387ea76124b 100644
--- a/libcxx/src/chrono.cpp
+++ b/libcxx/src/chrono.cpp
@@ -124,7 +124,7 @@ static system_clock::time_point __libcpp_system_clock_now() {
 static system_clock::time_point __libcpp_system_clock_now() {
   struct timespec ts;
   if (timespec_get(&ts, TIME_UTC) != TIME_UTC)
-    __throw_system_error(errno, "timespec_get(TIME_UTC) failed");
+    std::__throw_system_error(errno, "timespec_get(TIME_UTC) failed");
   return system_clock::time_point(seconds(ts.tv_sec) + microseconds(ts.tv_nsec / 1000));
 }
 
@@ -133,7 +133,7 @@ static system_clock::time_point __libcpp_system_clock_now() {
 static system_clock::time_point __libcpp_system_clock_now() {
   struct timespec tp;
   if (0 != clock_gettime(CLOCK_REALTIME, &tp))
-    __throw_system_error(errno, "clock_gettime(CLOCK_REALTIME) failed");
+    std::__throw_system_error(errno, "clock_gettime(CLOCK_REALTIME) failed");
   return system_clock::time_point(seconds(tp.tv_sec) + microseconds(tp.tv_nsec / 1000));
 }
 
@@ -180,7 +180,7 @@ system_clock::time_point system_clock::from_time_t(time_t t) noexcept { return s
 static steady_clock::time_point __libcpp_steady_clock_now() {
   struct timespec tp;
   if (0 != clock_gettime(CLOCK_MONOTONIC_RAW, &tp))
-    __throw_system_error(errno, "clock_gettime(CLOCK_MONOTONIC_RAW) failed");
+    std::__throw_system_error(errno, "clock_gettime(CLOCK_MONOTONIC_RAW) failed");
   return steady_clock::time_point(seconds(tp.tv_sec) + nanoseconds(tp.tv_nsec));
 }
 
@@ -213,7 +213,7 @@ static steady_clock::time_point __libcpp_steady_clock_now() {
 static steady_clock::time_point __libcpp_steady_clock_now() {
   struct timespec64 ts;
   if (0 != gettimeofdayMonotonic(&ts))
-    __throw_system_error(errno, "failed to obtain time of day");
+    std::__throw_system_error(errno, "failed to obtain time of day");
 
   return steady_clock::time_point(seconds(ts.tv_sec) + nanoseconds(ts.tv_nsec));
 }
@@ -234,7 +234,7 @@ static steady_clock::time_point __libcpp_steady_clock_now() noexcept {
 static steady_clock::time_point __libcpp_steady_clock_now() {
   struct timespec ts;
   if (timespec_get(&ts, TIME_MONOTONIC) != TIME_MONOTONIC)
-    __throw_system_error(errno, "timespec_get(TIME_MONOTONIC) failed");
+    std::__throw_system_error(errno, "timespec_get(TIME_MONOTONIC) failed");
   return steady_clock::time_point(seconds(ts.tv_sec) + microseconds(ts.tv_nsec / 1000));
 }
 
@@ -243,7 +243,7 @@ static steady_clock::time_point __libcpp_steady_clock_now() {
 static steady_clock::time_point __libcpp_steady_clock_now() {
   struct timespec tp;
   if (0 != clock_gettime(CLOCK_MONOTONIC, &tp))
-    __throw_system_error(errno, "clock_gettime(CLOCK_MONOTONIC) failed");
+    std::__throw_system_error(errno, "clock_gettime(CLOCK_MONOTONIC) failed");
   return steady_clock::time_point(seconds(tp.tv_sec) + nanoseconds(tp.tv_nsec));
 }
 
diff --git a/libcxx/src/condition_variable.cpp b/libcxx/src/condition_variable.cpp
index db60571cf5f56..b3747603dd34f 100644
--- a/libcxx/src/condition_variable.cpp
+++ b/libcxx/src/condition_variable.cpp
@@ -26,17 +26,17 @@ void condition_variable::notify_all() noexcept { __libcpp_condvar_broadcast(&__c
 
 void condition_variable::wait(unique_lock<mutex>& lk) noexcept {
   if (!lk.owns_lock())
-    __throw_system_error(EPERM, "condition_variable::wait: mutex not locked");
+    std::__throw_system_error(EPERM, "condition_variable::wait: mutex not locked");
   int ec = __libcpp_condvar_wait(&__cv_, lk.mutex()->native_handle());
   if (ec)
-    __throw_system_error(ec, "condition_variable wait failed");
+    std::__throw_system_error(ec, "condition_variable wait failed");
 }
 
 void condition_variable::__do_timed_wait(unique_lock<mutex>& lk,
                                          chrono::time_point<chrono::system_clock, chrono::nanoseconds> tp) noexcept {
   using namespace chrono;
   if (!lk.owns_lock())
-    __throw_system_error(EPERM, "condition_variable::timed wait: mutex not locked");
+    std::__throw_system_error(EPERM, "condition_variable::timed wait: mutex not locked");
   nanoseconds d = tp.time_since_epoch();
   if (d > nanoseconds(0x59682F000000E941))
     d = nanoseconds(0x59682F000000E941);
@@ -53,7 +53,7 @@ void condition_variable::__do_timed_wait(unique_lock<mutex>& lk,
   }
   int ec = __libcpp_condvar_timedwait(&__cv_, lk.mutex()->native_handle(), &ts);
   if (ec != 0 && ec != ETIMEDOUT)
-    __throw_system_error(ec, "condition_variable timed_wait failed");
+    std::__throw_system_error(ec, "condition_variable timed_wait failed");
 }
 
 void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk) {
diff --git a/libcxx/src/filesystem/error.h b/libcxx/src/filesystem/error.h
index c0213910b3780..7d81d4b6d2143 100644
--- a/libcxx/src/filesystem/error.h
+++ b/libcxx/src/filesystem/error.h
@@ -96,11 +96,11 @@ struct ErrorHandler {
     string what = string("in ") + func_name_;
     switch (bool(p1_) + bool(p2_)) {
     case 0:
-      __throw_filesystem_error(what, ec);
+      filesystem::__throw_filesystem_error(what, ec);
     case 1:
-      __throw_filesystem_error(what, *p1_, ec);
+      filesystem::__throw_filesystem_error(what, *p1_, ec);
     case 2:
-      __throw_filesystem_error(what, *p1_, *p2_, ec);
+      filesystem::__throw_filesystem_error(what, *p1_, *p2_, ec);
     }
     __libcpp_unreachable();
   }
@@ -114,11 +114,11 @@ struct ErrorHandler {
     string what = string("in ") + func_name_ + ": " + detail::vformat_string(msg, ap);
     switch (bool(p1_) + bool(p2_)) {
     case 0:
-      __throw_filesystem_error(what, ec);
+      filesystem::__throw_filesystem_error(what, ec);
     case 1:
-      __throw_filesystem_error(what, *p1_, ec);
+      filesystem::__throw_filesystem_error(what, *p1_, ec);
     case 2:
-      __throw_filesystem_error(what, *p1_, *p2_, ec);
+      filesystem::__throw_filesystem_error(what, *p1_, *p2_, ec);
     }
     __libcpp_unreachable();
   }
diff --git a/libcxx/src/filesystem/filesystem_clock.cpp b/libcxx/src/filesystem/filesystem_clock.cpp
index e1f8870722018..bec082f61c9d3 100644
--- a/libcxx/src/filesystem/filesystem_clock.cpp
+++ b/libcxx/src/filesystem/filesystem_clock.cpp
@@ -58,13 +58,13 @@ _FilesystemClock::time_point _FilesystemClock::now() noexcept {
   typedef chrono::duration<rep, nano> __nsecs;
   struct timespec ts;
   if (timespec_get(&ts, TIME_UTC) != TIME_UTC)
-    __throw_system_error(errno, "timespec_get(TIME_UTC) failed");
+    std::__throw_system_error(errno, "timespec_get(TIME_UTC) failed");
   return time_point(__secs(ts.tv_sec) + chrono::duration_cast<duration>(__nsecs(ts.tv_nsec)));
 #elif defined(_LIBCPP_HAS_CLOCK_GETTIME)
   typedef chrono::duration<rep, nano> __nsecs;
   struct timespec tp;
   if (0 != clock_gettime(CLOCK_REALTIME, &tp))
-    __throw_system_error(errno, "clock_gettime(CLOCK_REALTIME) failed");
+    std::__throw_system_error(errno, "clock_gettime(CLOCK_REALTIME) failed");
   return time_point(__secs(tp.tv_sec) + chrono::duration_cast<duration>(__nsecs(tp.tv_nsec)));
 #else
   typedef chrono::duration<rep, micro> __microsecs;
diff --git a/libcxx/src/future.cpp b/libcxx/src/future.cpp
index 04e6fb8db6459..7bba635e9006f 100644
--- a/libcxx/src/future.cpp
+++ b/libcxx/src/future.cpp
@@ -62,7 +62,7 @@ void __assoc_sub_state::__on_zero_shared() noexcept { delete this; }
 void __assoc_sub_state::set_value() {
   unique_lock<mutex> __lk(__mut_);
   if (__has_value())
-    __throw_future_error(future_errc::promise_already_satisfied);
+    std::__throw_future_error(future_errc::promise_already_satisfied);
   __state_ |= __constructed | ready;
   __cv_.notify_all();
 }
@@ -70,7 +70,7 @@ void __assoc_sub_state::set_value() {
 void __assoc_sub_state::set_value_at_thread_exit() {
   unique_lock<mutex> __lk(__mut_);
   if (__has_value())
-    __throw_future_error(future_errc::promise_already_satisfied);
+    std::__throw_future_error(future_errc::promise_already_satisfied);
   __state_ |= __constructed;
   __thread_local_data()->__make_ready_at_thread_exit(this);
 }
@@ -78,7 +78,7 @@ void __assoc_sub_state::set_value_at_thread_exit() {
 void __assoc_sub_state::set_exception(exception_ptr __p) {
   unique_lock<mutex> __lk(__mut_);
   if (__has_value())
-    __throw_future_error(future_errc::promise_already_satisfied);
+    std::__throw_future_error(future_errc::promise_already_satisfied);
   __exception_ = __p;
   __state_ |= ready;
   __cv_.notify_all();
@@ -87,7 +87,7 @@ void __assoc_sub_state::set_exception(exception_ptr __p) {
 void __assoc_sub_state::set_exception_at_thread_exit(exception_ptr __p) {
   unique_lock<mutex> __lk(__mut_);
   if (__has_value())
-    __throw_future_error(future_errc::promise_already_satisfied);
+    std::__throw_future_error(future_errc::promise_already_satisfied);
   __exception_ = __p;
   __thread_local_data()->__make_ready_at_thread_exit(this);
 }
@@ -122,7 +122,7 @@ void __assoc_sub_state::__sub_wait(unique_lock<mutex>& __lk) {
   }
 }
 
-void __assoc_sub_state::__execute() { __throw_future_error(future_errc::no_state); }
+void __assoc_sub_state::__execute() { std::__throw_future_error(future_errc::no_state); }
 
 future<void>::future(__assoc_sub_state* __state) : __state_(__state) { __state_->__attach_future(); }
 
@@ -152,31 +152,31 @@ promise<void>::~promise() {
 
 future<void> promise<void>::get_future() {
   if (__state_ == nullptr)
-    __throw_future_error(future_errc::no_state);
+    std::__throw_future_error(future_errc::no_state);
   return future<void>(__state_);
 }
 
 void promise<void>::set_value() {
   if (__state_ == nullptr)
-    __throw_future_error(future_errc::no_state);
+    std::__throw_future_error(future_errc::no_state);
   __state_->set_value();
 }
 
 void promise<void>::set_exception(exception_ptr __p) {
   if (__state_ == nullptr)
-    __throw_future_error(future_errc::no_state);
+    std::__throw_future_error(future_errc::no_state);
   __state_->set_exception(__p);
 }
 
 void promise<void>::set_value_at_thread_exit() {
   if (__state_ == nullptr)
-    __throw_future_error(future_errc::no_state);
+    std::__throw_future_error(future_errc::no_state);
   __state_->set_value_at_thread_exit();
 }
 
 void promise<void>::set_exception_at_thread_exit(exception_ptr __p) {
   if (__state_ == nullptr)
-    __throw_future_error(future_errc::no_state);
+    std::__throw_future_error(future_errc::no_state);
   __state_->set_exception_at_thread_exit(__p);
 }
 
diff --git a/libcxx/src/hash.cpp b/libcxx/src/hash.cpp
index 34b02b8eafc21..41c4eb480a5fc 100644
--- a/libcxx/src/hash.cpp
+++ b/libcxx/src/hash.cpp
@@ -55,13 +55,13 @@ const unsigned indices[] = {
 template <size_t _Sz = sizeof(size_t)>
 inline _LIBCPP_HIDE_FROM_ABI typename enable_if<_Sz == 4, void>::type __check_for_overflow(size_t N) {
   if (N > 0xFFFFFFFB)
-    __throw_overflow_error("__next_prime overflow");
+    std::__throw_overflow_error("__next_prime overflow");
 }
 
 template <size_t _Sz = sizeof(size_t)>
 inline _LIBCPP_HIDE_FROM_ABI typename enable_if<_Sz == 8, void>::type __check_for_overflow(size_t N) {
   if (N > 0xFFFFFFFFFFFFFFC5ull)
-    __throw_overflow_error("__next_prime overflow");
+    std::__throw_overflow_error("__next_prime overflow");
 }
 
 size_t __next_prime(size_t n) {
diff --git a/libcxx/src/ios.cpp b/libcxx/src/ios.cpp
index 4bb6f80e0ec31..02ce4841187fb 100644
--- a/libcxx/src/ios.cpp
+++ b/libcxx/src/ios.cpp
@@ -217,7 +217,7 @@ void ios_base::clear(iostate state) {
     __rdstate_ = state | badbit;
 
   if (((state | (__rdbuf_ ? goodbit : badbit)) & __exceptions_) != 0)
-    __throw_failure("ios_base::clear");
+    std::__throw_failure("ios_base::clear");
 }
 
 // init
@@ -253,24 +253,24 @@ void ios_base::copyfmt(const ios_base& rhs) {
     size_t newesize = sizeof(event_callback) * rhs.__event_size_;
     new_callbacks.reset(static_cast<event_callback*>(malloc(newesize)));
     if (!new_callbacks)
-      __throw_bad_alloc();
+      std::__throw_bad_alloc();
 
     size_t newisize = sizeof(int) * rhs.__event_size_;
     new_ints.reset(static_cast<int*>(malloc(newisize)));
     if (!new_ints)
-      __throw_bad_alloc();
+      std::__throw_bad_alloc();
   }
   if (__iarray_cap_ < rhs.__iarray_size_) {
     size_t newsize = sizeof(long) * rhs.__iarray_size_;
     new_longs.reset(static_cast<long*>(malloc(newsize)));
     if (!new_longs)
-      __throw_bad_alloc();
+      std::__throw_bad_alloc();
   }
   if (__parray_cap_ < rhs.__parray_size_) {
     size_t newsize = sizeof(void*) * rhs.__parray_size_;
     new_pointers.reset(static_cast<void**>(malloc(newsize)));
     if (!new_pointers)
-      __throw_bad_alloc();
+      std::__throw_bad_alloc();
   }
   // Got everything we need.  Copy everything but __rdstate_, __rdbuf_ and __exceptions_
   __fmtflags_           = rhs.__fmtflags_;
diff --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp
index b5908bf8be725..9ea59a3a19ca4 100644
--- a/libcxx/src/locale.cpp
+++ b/libcxx/src/locale.cpp
@@ -482,7 +482,7 @@ void locale::__imp::install(facet* f, long id) {
 
 const locale::facet* locale::__imp::use_facet(long id) const {
   if (!has_facet(id))
-    __throw_bad_cast();
+    std::__throw_bad_cast();
   return facets_[static_cast<size_t>(id)];
 }
 
@@ -602,7 +602,7 @@ long locale::id::__get() {
 collate_byname<char>::collate_byname(const char* n, size_t refs)
     : collate<char>(refs), __l_(__locale::__newlocale(_LIBCPP_ALL_MASK, n, 0)) {
   if (__l_ == 0)
-    __throw_runtime_error(
+    std::__throw_runtime_error(
         ("collate_byname<char>::collate_byname"
          " failed to construct for " +
          string(n))
@@ -612,7 +612,7 @@ collate_byname<char>::collate_byname(const char* n, size_t refs)
 collate_byname<char>::collate_byname(const string& name, size_t refs)
     : collate<char>(refs), __l_(__locale::__newlocale(_LIBCPP_ALL_MASK, name.c_str(), 0)) {
   if (__l_ == 0)
-    __throw_runtime_error(
+    std::__throw_runtime_error(
         ("collate_byname<char>::collate_byname"
          " failed to construct for " +
          name)
@@ -646,7 +646,7 @@ collate_byname<char>::string_type collate_byname<char>::do_transform(const char_
 collate_byname<wchar_t>::collate_byname(const char* n, size_t refs)
     : collate<wchar_t>(refs), __l_(__locale::__newlocale(_LIBCPP_ALL_MASK, n, 0)) {
   if (__l_ == 0)
-    __throw_runtime_error(
+    std::__throw_runtime_error(
         ("collate_byname<wchar_t>::collate_byname(size_t refs)"
          " failed to construct for " +
          string(n))
@@ -656,7 +656,7 @@ collate_byname<wchar_t>::collate_byname(const char* n, size_t refs)
 collate_byname<wchar_t>::collate_byname(const string& name, size_t refs)
     : collate<wchar_t>(refs), __l_(__locale::__newlocale(_LIBCPP_ALL_MASK, name.c_str(), 0)) {
   if (__l_ == 0)
-    __throw_runtime_error(
+    std::__throw_runtime_error(
         ("collate_byname<wchar_t>::collate_byname(size_t refs)"
          " failed to construct for " +
          name)
@@ -1049,7 +1049,7 @@ const unsigned short* ctype<char>::__classic_upper_table() _NOEXCEPT {
 ctype_byname<char>::ctype_byname(const char* name, size_t refs)
     : ctype<char>(0, false, refs), __l_(__locale::__newlocale(_LIBCPP_ALL_MASK, name, 0)) {
   if (__l_ == 0)
-    __throw_runtime_error(
+    std::__throw_runtime_error(
         ("ctype_byname<char>::ctype_byname"
          " failed to construct for " +
          string(name))
@@ -1059,7 +1059,7 @@ ctype_byname<char>::ctype_byname(const char* name, size_t refs)
 ctype_byname<char>::ctype_byname(const string& name, size_t refs)
     : ctype<char>(0, false, refs), __l_(__locale::__newlocale(_LIBCPP_ALL_MASK, name.c_str(), 0)) {
   if (__l_ == 0)
-    __throw_runtime_error(
+    std::__throw_runtime_error(
         ("ctype_byname<char>::ctype_byname"
          " failed to construct for " +
          name)
@@ -1094,7 +1094,7 @@ const char* ctype_byname<char>::do_tolower(char_type* low, const char_type* high
 ctype_byname<wchar_t>::ctype_byname(const char* name, size_t refs)
     : ctype<wchar_t>(refs), __l_(__locale::__newlocale(_LIBCPP_ALL_MASK, name, 0)) {
   if (__l_ == 0)
-    __throw_runtime_error(
+    std::__throw_runtime_error(
         ("ctype_byname<wchar_t>::ctype_byname"
          " failed to construct for " +
          string(name))
@@ -1104,7 +1104,7 @@ ctype_byname<wchar_t>::ctype_byname(const char* name, size_t refs)
 ctype_byname<wchar_t>::ctype_byname(const string& name, size_t refs)
     : ctype<wchar_t>(refs), __l_(__locale::__newlocale(_LIBCPP_ALL_MASK, name.c_str(), 0)) {
   if (__l_ == 0)
-    __throw_runtime_error(
+    std::__throw_runtime_error(
         ("ctype_byname<wchar_t>::ctype_byname"
          " failed to construct for " +
          name)
@@ -1344,7 +1344,7 @@ codecvt<wchar_t, char, mbstate_t>::codecvt(size_t refs) : locale::facet(refs), _
 codecvt<wchar_t, char, mbstate_t>::codecvt(const char* nm, size_t refs)
     : locale::facet(refs), __l_(__locale::__newlocale(_LIBCPP_ALL_MASK, nm, 0)) {
   if (__l_ == 0)
-    __throw_runtime_error(
+    std::__throw_runtime_error(
         ("codecvt_byname<wchar_t, char, mbstate_t>::codecvt_byname"
          " failed to construct for " +
          string(nm))
@@ -4061,7 +4061,7 @@ void numpunct_byname<char>::__init(const char* nm) {
   if (strcmp(nm, "C") != 0) {
     __libcpp_unique_locale loc(nm);
     if (!loc)
-      __throw_runtime_error(
+      std::__throw_runtime_error(
           ("numpunct_byname<char>::numpunct_byname"
            " failed to construct for " +
            string(nm))
@@ -4092,7 +4092,7 @@ void numpunct_byname<wchar_t>::__init(const char* nm) {
   if (strcmp(nm, "C") != 0) {
     __libcpp_unique_locale loc(nm);
     if (!loc)
-      __throw_runtime_error(
+      std::__throw_runtime_error(
           ("numpunct_byname<wchar_t>::numpunct_byname"
            " failed to construct for " +
            string(nm))
@@ -4444,12 +4444,12 @@ const wstring& __time_get_c_storage<wchar_t>::__r() const {
 
 __time_get::__time_get(const char* nm) : __loc_(__locale::__newlocale(_LIBCPP_ALL_MASK, nm, 0)) {
   if (__loc_ == 0)
-    __throw_runtime_error(("time_get_byname failed to construct for " + string(nm)).c_str());
+    std::__throw_runtime_error(("time_get_byname failed to construct for " + string(nm)).c_str());
 }
 
 __time_get::__time_get(const string& nm) : __loc_(__locale::__newlocale(_LIBCPP_ALL_MASK, nm.c_str(), 0)) {
   if (__loc_ == 0)
-    __throw_runtime_error(("time_get_byname failed to construct for " + nm).c_str());
+    std::__throw_runtime_error(("time_get_byname failed to construct for " + nm).c_str());
 }
 
 __time_get::~__time_get() { __locale::__freelocale(__loc_); }
@@ -4610,7 +4610,7 @@ wstring __time_get_storage<wchar_t>::__analyze(char fmt, const ctype<wchar_t>& c
   const char* bb = buf;
   size_t j       = __locale::__mbsrtowcs(wbb, &bb, countof(wbuf), &mb, __loc_);
   if (j == size_t(-1))
-    __throw_runtime_error("locale not supported");
+    std::__throw_runtime_error("locale not supported");
   wchar_t* wbe = wbb + j;
   wstring result;
   while (wbb != wbe) {
@@ -4771,7 +4771,7 @@ void __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct) {
     const char* bb = buf;
     size_t j       = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, __loc_);
     if (j == size_t(-1) || j == 0)
-      __throw_runtime_error("locale not supported");
+      std::__throw_runtime_error("locale not supported");
     wbe = wbuf + j;
     __weeks_[i].assign(wbuf, wbe);
     __locale::__strftime(buf, countof(buf), "%a", &t, __loc_);
@@ -4779,7 +4779,7 @@ void __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct) {
     bb = buf;
     j  = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, __loc_);
     if (j == size_t(-1) || j == 0)
-      __throw_runtime_error("locale not supported");
+      std::__throw_runtime_error("locale not supported");
     wbe = wbuf + j;
     __weeks_[i + 7].assign(wbuf, wbe);
   }
@@ -4791,7 +4791,7 @@ void __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct) {
     const char* bb = buf;
     size_t j       = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, __loc_);
     if (j == size_t(-1) || j == 0)
-      __throw_runtime_error("locale not supported");
+      std::__throw_runtime_error("locale not supported");
     wbe = wbuf + j;
     __months_[i].assign(wbuf, wbe);
     __locale::__strftime(buf, countof(buf), "%b", &t, __loc_);
@@ -4799,7 +4799,7 @@ void __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct) {
     bb = buf;
     j  = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, __loc_);
     if (j == size_t(-1) || j == 0)
-      __throw_runtime_error("locale not supported");
+      std::__throw_runtime_error("locale not supported");
     wbe = wbuf + j;
     __months_[i + 12].assign(wbuf, wbe);
   }
@@ -4810,7 +4810,7 @@ void __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct) {
   const char* bb = buf;
   size_t j       = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, __loc_);
   if (j == size_t(-1))
-    __throw_runtime_error("locale not supported");
+    std::__throw_runtime_error("locale not supported");
   wbe = wbuf + j;
   __am_pm_[0].assign(wbuf, wbe);
   t.tm_hour = 13;
@@ -4819,7 +4819,7 @@ void __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct) {
   bb = buf;
   j  = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, __loc_);
   if (j == size_t(-1))
-    __throw_runtime_error("locale not supported");
+    std::__throw_runtime_error("locale not supported");
   wbe = wbuf + j;
   __am_pm_[1].assign(wbuf, wbe);
   __c_ = __analyze('c', ct);
@@ -5029,12 +5029,12 @@ time_base::dateorder __time_get_storage<wchar_t>::__do_date_order() const {
 
 __time_put::__time_put(const char* nm) : __loc_(__locale::__newlocale(_LIBCPP_ALL_MASK, nm, 0)) {
   if (__loc_ == 0)
-    __throw_runtime_error(("time_put_byname failed to construct for " + string(nm)).c_str());
+    std::__throw_runtime_error(("time_put_byname failed to construct for " + string(nm)).c_str());
 }
 
 __time_put::__time_put(const string& nm) : __loc_(__locale::__newlocale(_LIBCPP_ALL_MASK, nm.c_str(), 0)) {
   if (__loc_ == 0)
-    __throw_runtime_error(("time_put_byname failed to construct for " + nm).c_str());
+    std::__throw_runtime_error(("time_put_byname failed to construct for " + nm).c_str());
 }
 
 __time_put::~__time_put() {
@@ -5059,7 +5059,7 @@ void __time_put::__do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm, char __
   const char* __nb = __nar;
   size_t j         = __locale::__mbsrtowcs(__wb, &__nb, countof(__wb, __we), &mb, __loc_);
   if (j == size_t(-1))
-    __throw_runtime_error("locale not supported");
+    std::__throw_runtime_error("locale not supported");
   __we = __wb + j;
 }
 #endif // _LIBCPP_HAS_WIDE_CHARACTERS
@@ -5431,7 +5431,7 @@ void moneypunct_byname<char, false>::init(const char* nm) {
   typedef moneypunct<char, false> base;
   __libcpp_unique_locale loc(nm);
   if (!loc)
-    __throw_runtime_error(("moneypunct_byname failed to construct for " + string(nm)).c_str());
+    std::__throw_runtime_error(("moneypunct_byname failed to construct for " + string(nm)).c_str());
 
   __locale::__lconv_t* lc = __locale::__localeconv(loc.get());
   if (!checked_string_to_char_convert(__decimal_point_, lc->mon_decimal_point, loc.get()))
@@ -5466,7 +5466,7 @@ void moneypunct_byname<char, true>::init(const char* nm) {
   typedef moneypunct<char, true> base;
   __libcpp_unique_locale loc(nm);
   if (!loc)
-    __throw_runtime_error(("moneypunct_byname failed to construct for " + string(nm)).c_str());
+    std::__throw_runtime_error(("moneypunct_byname failed to construct for " + string(nm)).c_str());
 
   __locale::__lconv_t* lc = __locale::__localeconv(loc.get());
   if (!checked_string_to_char_convert(__decimal_point_, lc->mon_decimal_point, loc.get()))
@@ -5522,7 +5522,7 @@ void moneypunct_byname<wchar_t, false>::init(const char* nm) {
   typedef moneypunct<wchar_t, false> base;
   __libcpp_unique_locale loc(nm);
   if (!loc)
-    __throw_runtime_error(("moneypunct_byname failed to construct for " + string(nm)).c_str());
+    std::__throw_runtime_error(("moneypunct_byname failed to construct for " + string(nm)).c_str());
   __locale::__lconv_t* lc = __locale::__localeconv(loc.get());
   if (!checked_string_to_wchar_convert(__decimal_point_, lc->mon_decimal_point, loc.get()))
     __decimal_point_ = base::do_decimal_point();
@@ -5534,7 +5534,7 @@ void moneypunct_byname<wchar_t, false>::init(const char* nm) {
   const char* bb = lc->currency_symbol;
   size_t j       = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, loc.get());
   if (j == size_t(-1))
-    __throw_runtime_error("locale not supported");
+    std::__throw_runtime_error("locale not supported");
   wchar_t* wbe = wbuf + j;
   __curr_symbol_.assign(wbuf, wbe);
   if (lc->frac_digits != CHAR_MAX)
@@ -5548,7 +5548,7 @@ void moneypunct_byname<wchar_t, false>::init(const char* nm) {
     bb = lc->positive_sign;
     j  = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, loc.get());
     if (j == size_t(-1))
-      __throw_runtime_error("locale not supported");
+      std::__throw_runtime_error("locale not supported");
     wbe = wbuf + j;
     __positive_sign_.assign(wbuf, wbe);
   }
@@ -5559,7 +5559,7 @@ void moneypunct_byname<wchar_t, false>::init(const char* nm) {
     bb = lc->negative_sign;
     j  = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, loc.get());
     if (j == size_t(-1))
-      __throw_runtime_error("locale not supported");
+      std::__throw_runtime_error("locale not supported");
     wbe = wbuf + j;
     __negative_sign_.assign(wbuf, wbe);
   }
@@ -5576,7 +5576,7 @@ void moneypunct_byname<wchar_t, true>::init(const char* nm) {
   typedef moneypunct<wchar_t, true> base;
   __libcpp_unique_locale loc(nm);
   if (!loc)
-    __throw_runtime_error(("moneypunct_byname failed to construct for " + string(nm)).c_str());
+    std::__throw_runtime_error(("moneypunct_byname failed to construct for " + string(nm)).c_str());
 
   __locale::__lconv_t* lc = __locale::__localeconv(loc.get());
   if (!checked_string_to_wchar_convert(__decimal_point_, lc->mon_decimal_point, loc.get()))
@@ -5589,7 +5589,7 @@ void moneypunct_byname<wchar_t, true>::init(const char* nm) {
   const char* bb = lc->int_curr_symbol;
   size_t j       = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, loc.get());
   if (j == size_t(-1))
-    __throw_runtime_error("locale not supported");
+    std::__throw_runtime_error("locale not supported");
   wchar_t* wbe = wbuf + j;
   __curr_symbol_.assign(wbuf, wbe);
   if (lc->int_frac_digits != CHAR_MAX)
@@ -5607,7 +5607,7 @@ void moneypunct_byname<wchar_t, true>::init(const char* nm) {
     bb = lc->positive_sign;
     j  = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, loc.get());
     if (j == size_t(-1))
-      __throw_runtime_error("locale not supported");
+      std::__throw_runtime_error("locale not supported");
     wbe = wbuf + j;
     __positive_sign_.assign(wbuf, wbe);
   }
@@ -5622,7 +5622,7 @@ void moneypunct_byname<wchar_t, true>::init(const char* nm) {
     bb = lc->negative_sign;
     j  = __locale::__mbsrtowcs(wbuf, &bb, countof(wbuf), &mb, loc.get());
     if (j == size_t(-1))
-      __throw_runtime_error("locale not supported");
+      std::__throw_runtime_error("locale not supported");
     wbe = wbuf + j;
     __negative_sign_.assign(wbuf, wbe);
   }
diff --git a/libcxx/src/memory_resource.cpp b/libcxx/src/memory_resource.cpp
index ec9565f731bfa..22b5493427f0f 100644
--- a/libcxx/src/memory_resource.cpp
+++ b/libcxx/src/memory_resource.cpp
@@ -48,7 +48,7 @@ class _LIBCPP_HIDDEN __new_delete_memory_resource_imp : public memory_resource {
     std::byte* result = std::__libcpp_allocate<std::byte>(__element_count(bytes), align);
     if (!is_aligned_to(result, align)) {
       std::__libcpp_deallocate<std::byte>(result, __element_count(bytes), align);
-      __throw_bad_alloc();
+      std::__throw_bad_alloc();
     }
     return result;
 #endif
@@ -64,7 +64,7 @@ class _LIBCPP_HIDDEN __new_delete_memory_resource_imp : public memory_resource {
 // null_memory_resource()
 
 class _LIBCPP_HIDDEN __null_memory_resource_imp : public memory_resource {
-  void* do_allocate(size_t, size_t) override { __throw_bad_alloc(); }
+  void* do_allocate(size_t, size_t) override { std::__throw_bad_alloc(); }
   void do_deallocate(void*, size_t, size_t) override {}
   bool do_is_equal(const memory_resource& other) const noexcept override { return &other == this; }
 };
diff --git a/libcxx/src/mutex.cpp b/libcxx/src/mutex.cpp
index 2f8504d602dc9..b2193e2335ee2 100644
--- a/libcxx/src/mutex.cpp
+++ b/libcxx/src/mutex.cpp
@@ -28,7 +28,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 void mutex::lock() {
   int ec = __libcpp_mutex_lock(&__m_);
   if (ec)
-    __throw_system_error(ec, "mutex lock failed");
+    std::__throw_system_error(ec, "mutex lock failed");
 }
 
 bool mutex::try_lock() noexcept { return __libcpp_mutex_trylock(&__m_); }
@@ -45,7 +45,7 @@ void mutex::unlock() noexcept {
 recursive_mutex::recursive_mutex() {
   int ec = __libcpp_recursive_mutex_init(&__m_);
   if (ec)
-    __throw_system_error(ec, "recursive_mutex constructor failed");
+    std::__throw_system_error(ec, "recursive_mutex constructor failed");
 }
 
 recursive_mutex::~recursive_mutex() {
@@ -57,7 +57,7 @@ recursive_mutex::~recursive_mutex() {
 void recursive_mutex::lock() {
   int ec = __libcpp_recursive_mutex_lock(&__m_);
   if (ec)
-    __throw_system_error(ec, "recursive_mutex lock failed");
+    std::__throw_system_error(ec, "recursive_mutex lock failed");
 }
 
 void recursive_mutex::unlock() noexcept {
@@ -108,7 +108,7 @@ void recursive_timed_mutex::lock() {
   unique_lock<mutex> lk(__m_);
   if (id == __id_) {
     if (__count_ == numeric_limits<size_t>::max())
-      __throw_system_error(EAGAIN, "recursive_timed_mutex lock limit reached");
+      std::__throw_system_error(EAGAIN, "recursive_timed_mutex lock limit reached");
     ++__count_;
     return;
   }
diff --git a/libcxx/src/print.cpp b/libcxx/src/print.cpp
index 4937aafe84177..3f2baa6dcc60b 100644
--- a/libcxx/src/print.cpp
+++ b/libcxx/src/print.cpp
@@ -51,7 +51,7 @@ __write_to_windows_console([[maybe_unused]] FILE* __stream, [[maybe_unused]] wst
                     __view.size(),
                     nullptr,
                     nullptr) == 0) {
-    __throw_system_error(filesystem::detail::get_last_error(), "failed to write formatted output");
+    std::__throw_system_error(filesystem::detail::get_last_error(), "failed to write formatted output");
   }
 }
 #  endif // _LIBCPP_HAS_WIDE_CHARACTERS
diff --git a/libcxx/src/random.cpp b/libcxx/src/random.cpp
index 3830e3918d2ee..ff53a3d786dd5 100644
--- a/libcxx/src/random.cpp
+++ b/libcxx/src/random.cpp
@@ -42,7 +42,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 random_device::random_device(const string& __token) {
   if (__token != "/dev/urandom")
-    __throw_system_error(ENOENT, ("random device not supported " + __token).c_str());
+    std::__throw_system_error(ENOENT, ("random device not supported " + __token).c_str());
 }
 
 random_device::~random_device() {}
@@ -52,7 +52,7 @@ unsigned random_device::operator()() {
   size_t n = sizeof(r);
   int err  = getentropy(&r, n);
   if (err)
-    __throw_system_error(errno, "random_device getentropy failed");
+    std::__throw_system_error(errno, "random_device getentropy failed");
   return r;
 }
 
@@ -68,7 +68,7 @@ unsigned random_device::operator()() { return arc4random(); }
 
 random_device::random_device(const string& __token) : __f_(open(__token.c_str(), O_RDONLY)) {
   if (__f_ < 0)
-    __throw_system_error(errno, ("random_device failed to open " + __token).c_str());
+    std::__throw_system_error(errno, ("random_device failed to open " + __token).c_str());
 }
 
 random_device::~random_device() { close(__f_); }
@@ -80,10 +80,10 @@ unsigned random_device::operator()() {
   while (n > 0) {
     ssize_t s = read(__f_, p, n);
     if (s == 0)
-      __throw_system_error(ENOMSG, "random_device got EOF");
+      std::__throw_system_error(ENOMSG, "random_device got EOF");
     if (s == -1) {
       if (errno != EINTR)
-        __throw_system_error(errno, "random_device got an unexpected error");
+        std::__throw_system_error(errno, "random_device got an unexpected error");
       continue;
     }
     n -= static_cast<size_t>(s);
@@ -96,10 +96,10 @@ unsigned random_device::operator()() {
 
 random_device::random_device(const string& __token) {
   if (__token != "/dev/urandom")
-    __throw_system_error(ENOENT, ("random device not supported " + __token).c_str());
+    std::__throw_system_error(ENOENT, ("random device not supported " + __token).c_str());
   int error = nacl_secure_random_init();
   if (error)
-    __throw_system_error(error, ("random device failed to open " + __token).c_str());
+    std::__throw_system_error(error, ("random device failed to open " + __token).c_str());
 }
 
 random_device::~random_device() {}
@@ -110,9 +110,9 @@ unsigned random_device::operator()() {
   size_t bytes_written;
   int error = nacl_secure_random(&r, n, &bytes_written);
   if (error != 0)
-    __throw_system_error(error, "random_device failed getting bytes");
+    std::__throw_system_error(error, "random_device failed getting bytes");
   else if (bytes_written != n)
-    __throw_runtime_error("random_device failed to obtain enough bytes");
+    std::__throw_runtime_error("random_device failed to obtain enough bytes");
   return r;
 }
 
@@ -120,7 +120,7 @@ unsigned random_device::operator()() {
 
 random_device::random_device(const string& __token) {
   if (__token != "/dev/urandom")
-    __throw_system_error(ENOENT, ("random device not supported " + __token).c_str());
+    std::__throw_system_error(ENOENT, ("random device not supported " + __token).c_str());
 }
 
 random_device::~random_device() {}
@@ -129,7 +129,7 @@ unsigned random_device::operator()() {
   unsigned r;
   errno_t err = rand_s(&r);
   if (err)
-    __throw_system_error(err, "random_device rand_s failed.");
+    std::__throw_system_error(err, "random_device rand_s failed.");
   return r;
 }
 
@@ -137,7 +137,7 @@ unsigned random_device::operator()() {
 
 random_device::random_device(const string& __token) {
   if (__token != "/dev/urandom")
-    __throw_system_error(ENOENT, ("random device not supported " + __token).c_str());
+    std::__throw_system_error(ENOENT, ("random device not supported " + __token).c_str());
 }
 
 random_device::~random_device() {}
diff --git a/libcxx/src/std_stream.h b/libcxx/src/std_stream.h
index 1bbaee695a226..772e8b91ae349 100644
--- a/libcxx/src/std_stream.h
+++ b/libcxx/src/std_stream.h
@@ -86,7 +86,7 @@ void __stdinbuf<_CharT>::imbue(const locale& __loc) {
   __encoding_      = __cv_->encoding();
   __always_noconv_ = __cv_->always_noconv();
   if (__encoding_ > __limit)
-    __throw_runtime_error("unsupported locale for standard input");
+    std::__throw_runtime_error("unsupported locale for standard input");
 }
 
 template <class _CharT>
diff --git a/libcxx/src/thread.cpp b/libcxx/src/thread.cpp
index 73f22f12d8ccd..db40d9df4f233 100644
--- a/libcxx/src/thread.cpp
+++ b/libcxx/src/thread.cpp
@@ -46,7 +46,7 @@ void thread::join() {
   }
 
   if (ec)
-    __throw_system_error(ec, "thread::join failed");
+    std::__throw_system_error(ec, "thread::join failed");
 }
 
 void thread::detach() {
@@ -58,7 +58,7 @@ void thread::detach() {
   }
 
   if (ec)
-    __throw_system_error(ec, "thread::detach failed");
+    std::__throw_system_error(ec, "thread::detach failed");
 }
 
 unsigned thread::hardware_concurrency() noexcept {

>From 80baffceb426e343f53e26185e2cfae2ca196538 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Tue, 18 Feb 2025 15:15:26 -0500
Subject: [PATCH 2/6] remove carve-out for 0-argument functions

---
 libcxx/test/tools/clang_tidy_checks/robust_against_adl.cpp | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libcxx/test/tools/clang_tidy_checks/robust_against_adl.cpp b/libcxx/test/tools/clang_tidy_checks/robust_against_adl.cpp
index 8825c3b77ef9a..1bfe96b414b7c 100644
--- a/libcxx/test/tools/clang_tidy_checks/robust_against_adl.cpp
+++ b/libcxx/test/tools/clang_tidy_checks/robust_against_adl.cpp
@@ -36,7 +36,6 @@ void robust_against_adl_check::registerMatchers(clang::ast_matchers::MatchFinder
   using namespace clang::ast_matchers;
   finder->addMatcher(
       callExpr(unless(isOperator()),
-               unless(argumentCountIs(0)),
                has(unresolvedLookupExpr(requiresADL(), unless(isCustomizationPoint()))),
                unless(callee(cxxMethodDecl(isStatic()))))
           .bind("ADLcall"),

>From 42cd114d72fc4fd321120e8bbc04afa51940446c Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Tue, 18 Feb 2025 15:16:42 -0500
Subject: [PATCH 3/6] Remove qualify_declval clang-tidy check

---
 libcxx/docs/CodingGuidelines.rst              |  2 +-
 .../tools/clang_tidy_checks/CMakeLists.txt    |  1 -
 .../tools/clang_tidy_checks/libcpp_module.cpp |  2 --
 .../clang_tidy_checks/qualify_declval.cpp     | 31 -------------------
 .../clang_tidy_checks/qualify_declval.hpp     | 18 -----------
 5 files changed, 1 insertion(+), 53 deletions(-)
 delete mode 100644 libcxx/test/tools/clang_tidy_checks/qualify_declval.cpp
 delete mode 100644 libcxx/test/tools/clang_tidy_checks/qualify_declval.hpp

diff --git a/libcxx/docs/CodingGuidelines.rst b/libcxx/docs/CodingGuidelines.rst
index 9bf23a4cfe08b..0c85cd07c0f61 100644
--- a/libcxx/docs/CodingGuidelines.rst
+++ b/libcxx/docs/CodingGuidelines.rst
@@ -36,7 +36,7 @@ Function overloading also applies to operators. Using ``&user_object`` may call
       ...
     }
 
-This is mostly enforced by the clang-tidy checks ``libcpp-robust-against-adl`` and ``libcpp-qualify-declval``.
+This is mostly enforced by the clang-tidy check ``libcpp-robust-against-adl``.
 
 Avoid including public headers
 ==============================
diff --git a/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt b/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt
index 0f8f0e8864d0f..f8b523ec0ba93 100644
--- a/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt
+++ b/libcxx/test/tools/clang_tidy_checks/CMakeLists.txt
@@ -94,7 +94,6 @@ set(SOURCES
     internal_ftm_use.cpp
     nodebug_on_aliases.cpp
     proper_version_checks.cpp
-    qualify_declval.cpp
     robust_against_adl.cpp
     uglify_attributes.cpp
 
diff --git a/libcxx/test/tools/clang_tidy_checks/libcpp_module.cpp b/libcxx/test/tools/clang_tidy_checks/libcpp_module.cpp
index bc7c8ce7ec443..32a33dddad632 100644
--- a/libcxx/test/tools/clang_tidy_checks/libcpp_module.cpp
+++ b/libcxx/test/tools/clang_tidy_checks/libcpp_module.cpp
@@ -15,7 +15,6 @@
 #include "internal_ftm_use.hpp"
 #include "nodebug_on_aliases.hpp"
 #include "proper_version_checks.hpp"
-#include "qualify_declval.hpp"
 #include "robust_against_adl.hpp"
 #include "uglify_attributes.hpp"
 
@@ -31,7 +30,6 @@ class LibcxxTestModule : public clang::tidy::ClangTidyModule {
     check_factories.registerCheck<libcpp::proper_version_checks>("libcpp-cpp-version-check");
     check_factories.registerCheck<libcpp::robust_against_adl_check>("libcpp-robust-against-adl");
     check_factories.registerCheck<libcpp::uglify_attributes>("libcpp-uglify-attributes");
-    check_factories.registerCheck<libcpp::qualify_declval>("libcpp-qualify-declval");
   }
 };
 } // namespace
diff --git a/libcxx/test/tools/clang_tidy_checks/qualify_declval.cpp b/libcxx/test/tools/clang_tidy_checks/qualify_declval.cpp
deleted file mode 100644
index f1c84ee16e92e..0000000000000
--- a/libcxx/test/tools/clang_tidy_checks/qualify_declval.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "qualify_declval.hpp"
-
-namespace {
-AST_MATCHER(clang::UnresolvedLookupExpr, requiresADL) { return Node.requiresADL(); }
-AST_MATCHER(clang::UnresolvedLookupExpr, isDeclval) { return Node.getName().getAsString() == "declval"; }
-} // namespace
-
-namespace libcpp {
-qualify_declval::qualify_declval(llvm::StringRef name, clang::tidy::ClangTidyContext* context)
-    : clang::tidy::ClangTidyCheck(name, context) {}
-
-void qualify_declval::registerMatchers(clang::ast_matchers::MatchFinder* finder) {
-  using namespace clang::ast_matchers;
-  finder->addMatcher(callExpr(has(unresolvedLookupExpr(requiresADL(), isDeclval()))).bind("ADLcall"), this);
-}
-
-void qualify_declval::check(const clang::ast_matchers::MatchFinder::MatchResult& result) {
-  if (const auto* call = result.Nodes.getNodeAs<clang::CallExpr>("ADLcall"); call != nullptr) {
-    diag(call->getBeginLoc(), "declval should be qualified to get better error messages")
-        << clang::FixItHint::CreateInsertion(call->getBeginLoc(), "std::");
-  }
-}
-} // namespace libcpp
diff --git a/libcxx/test/tools/clang_tidy_checks/qualify_declval.hpp b/libcxx/test/tools/clang_tidy_checks/qualify_declval.hpp
deleted file mode 100644
index 931f9ccf76627..0000000000000
--- a/libcxx/test/tools/clang_tidy_checks/qualify_declval.hpp
+++ /dev/null
@@ -1,18 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "clang-tidy/ClangTidyCheck.h"
-
-namespace libcpp {
-class qualify_declval : public clang::tidy::ClangTidyCheck {
-public:
-  qualify_declval(llvm::StringRef, clang::tidy::ClangTidyContext*);
-  void registerMatchers(clang::ast_matchers::MatchFinder*) override;
-  void check(const clang::ast_matchers::MatchFinder::MatchResult&) override;
-};
-} // namespace libcpp

>From 14f17b8be4386db3655e7b3699c2cb7408ff67ac Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Wed, 19 Feb 2025 08:21:32 -0500
Subject: [PATCH 4/6] Qualify more

---
 libcxx/include/__compare/common_comparison_category.h | 2 +-
 libcxx/include/__format/format_arg_store.h            | 2 +-
 libcxx/include/__ranges/elements_view.h               | 2 +-
 libcxx/include/map                                    | 6 ++++--
 libcxx/include/set                                    | 6 ++++--
 5 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/libcxx/include/__compare/common_comparison_category.h b/libcxx/include/__compare/common_comparison_category.h
index 215922abad6b0..00c8dd6e623cc 100644
--- a/libcxx/include/__compare/common_comparison_category.h
+++ b/libcxx/include/__compare/common_comparison_category.h
@@ -55,7 +55,7 @@ __compute_comp_type(const _ClassifyCompCategory (&__types)[_Size]) {
 template <class... _Ts, bool _False = false>
 _LIBCPP_HIDE_FROM_ABI constexpr auto __get_comp_type() {
   using _CCC                    = _ClassifyCompCategory;
-  constexpr _CCC __type_kinds[] = {_StrongOrd, __type_to_enum<_Ts>()...};
+  constexpr _CCC __type_kinds[] = {_StrongOrd, std::__type_to_enum<_Ts>()...};
   constexpr _CCC __cat          = __comp_detail::__compute_comp_type(__type_kinds);
   if constexpr (__cat == _None)
     return void();
diff --git a/libcxx/include/__format/format_arg_store.h b/libcxx/include/__format/format_arg_store.h
index 4c5ee9e9e4fd3..c6c7fdeedcfe6 100644
--- a/libcxx/include/__format/format_arg_store.h
+++ b/libcxx/include/__format/format_arg_store.h
@@ -164,7 +164,7 @@ consteval __arg_t __determine_arg_t() {
 template <class _Context, class _Tp>
 _LIBCPP_HIDE_FROM_ABI basic_format_arg<_Context> __create_format_arg(_Tp& __value) noexcept {
   using _Dp               = remove_const_t<_Tp>;
-  constexpr __arg_t __arg = __determine_arg_t<_Context, _Dp>();
+  constexpr __arg_t __arg = __format::__determine_arg_t<_Context, _Dp>();
   static_assert(__arg != __arg_t::__none, "the supplied type is not formattable");
   static_assert(__formattable_with<_Tp, _Context>);
 
diff --git a/libcxx/include/__ranges/elements_view.h b/libcxx/include/__ranges/elements_view.h
index 5121298fb684c..2edd31308cb68 100644
--- a/libcxx/include/__ranges/elements_view.h
+++ b/libcxx/include/__ranges/elements_view.h
@@ -197,7 +197,7 @@ class elements_view<_View, _Np>::__iterator
   }
 
 public:
-  using iterator_concept = decltype(__get_iterator_concept());
+  using iterator_concept = decltype(ranges::__get_iterator_concept());
   using value_type       = remove_cvref_t<tuple_element_t<_Np, range_value_t<_Base>>>;
   using difference_type  = range_difference_t<_Base>;
 
diff --git a/libcxx/include/map b/libcxx/include/map
index ef920bf11ef2a..37a8ec91b8f1f 100644
--- a/libcxx/include/map
+++ b/libcxx/include/map
@@ -1138,7 +1138,7 @@ public:
     insert(__m.begin(), __m.end());
   }
 
-  _LIBCPP_HIDE_FROM_ABI ~map() { static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); }
+  _LIBCPP_HIDE_FROM_ABI ~map() { static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), ""); }
 
   _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); }
   _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); }
@@ -1826,7 +1826,9 @@ public:
     insert(__m.begin(), __m.end());
   }
 
-  _LIBCPP_HIDE_FROM_ABI ~multimap() { static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); }
+  _LIBCPP_HIDE_FROM_ABI ~multimap() {
+    static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), "");
+  }
 
   _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); }
   _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); }
diff --git a/libcxx/include/set b/libcxx/include/set
index 3c6ea360bd06c..bd7bfef1f3e29 100644
--- a/libcxx/include/set
+++ b/libcxx/include/set
@@ -709,7 +709,7 @@ public:
   }
 #  endif // _LIBCPP_CXX03_LANG
 
-  _LIBCPP_HIDE_FROM_ABI ~set() { static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); }
+  _LIBCPP_HIDE_FROM_ABI ~set() { static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), ""); }
 
   _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); }
   _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); }
@@ -1174,7 +1174,9 @@ public:
   }
 #  endif // _LIBCPP_CXX03_LANG
 
-  _LIBCPP_HIDE_FROM_ABI ~multiset() { static_assert(sizeof(__diagnose_non_const_comparator<_Key, _Compare>()), ""); }
+  _LIBCPP_HIDE_FROM_ABI ~multiset() {
+    static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), "");
+  }
 
   _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); }
   _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); }

>From 10ab4dcc2b02f418e100a45859df53705784d415 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Wed, 19 Feb 2025 13:22:59 -0500
Subject: [PATCH 5/6] Fix namespace

---
 libcxx/include/__compare/common_comparison_category.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcxx/include/__compare/common_comparison_category.h b/libcxx/include/__compare/common_comparison_category.h
index 00c8dd6e623cc..6ddf9b9d45894 100644
--- a/libcxx/include/__compare/common_comparison_category.h
+++ b/libcxx/include/__compare/common_comparison_category.h
@@ -55,7 +55,7 @@ __compute_comp_type(const _ClassifyCompCategory (&__types)[_Size]) {
 template <class... _Ts, bool _False = false>
 _LIBCPP_HIDE_FROM_ABI constexpr auto __get_comp_type() {
   using _CCC                    = _ClassifyCompCategory;
-  constexpr _CCC __type_kinds[] = {_StrongOrd, std::__type_to_enum<_Ts>()...};
+  constexpr _CCC __type_kinds[] = {_StrongOrd, __comp_detail::__type_to_enum<_Ts>()...};
   constexpr _CCC __cat          = __comp_detail::__compute_comp_type(__type_kinds);
   if constexpr (__cat == _None)
     return void();

>From 33f48928b0be9c65d2756b4de0a286287da4d666 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Wed, 19 Feb 2025 13:51:36 -0500
Subject: [PATCH 6/6] Sneaky! That one was a static member function

---
 libcxx/include/__ranges/elements_view.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcxx/include/__ranges/elements_view.h b/libcxx/include/__ranges/elements_view.h
index 2edd31308cb68..b1419f2a1dd91 100644
--- a/libcxx/include/__ranges/elements_view.h
+++ b/libcxx/include/__ranges/elements_view.h
@@ -197,7 +197,7 @@ class elements_view<_View, _Np>::__iterator
   }
 
 public:
-  using iterator_concept = decltype(ranges::__get_iterator_concept());
+  using iterator_concept = decltype(__iterator::__get_iterator_concept());
   using value_type       = remove_cvref_t<tuple_element_t<_Np, range_value_t<_Base>>>;
   using difference_type  = range_difference_t<_Base>;
 



More information about the libcxx-commits mailing list