[llvm-branch-commits] [libcxx] [libc++] Implement std::move_only_function (P0288R9) (PR #94670)
Nikolas Klauser via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Nov 4 06:07:04 PST 2024
https://github.com/philnik777 updated https://github.com/llvm/llvm-project/pull/94670
>From 437730d68a0c7561a9ce774003a5dc818dc6398f Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Tue, 4 Jun 2024 09:15:57 +0200
Subject: [PATCH] [libc++] Implement P0288R9 (move_only_function)
---
libcxx/docs/FeatureTestMacroTable.rst | 3 +-
libcxx/docs/ReleaseNotes/20.rst | 1 +
libcxx/docs/Status/Cxx23Papers.csv | 2 +-
libcxx/include/CMakeLists.txt | 3 +
libcxx/include/__configuration/abi.h | 2 +
.../include/__functional/move_only_function.h | 97 +++
.../__functional/move_only_function_common.h | 46 ++
.../__functional/move_only_function_impl.h | 234 ++++++
libcxx/include/__utility/pointer_int_pair.h | 3 +
libcxx/include/functional | 4 +
libcxx/include/module.modulemap | 3 +
libcxx/include/version | 2 +-
libcxx/modules/std.cppm.in | 1 +
libcxx/test/libcxx/private_headers.verify.cpp | 717 ++++++++++++++++++
.../func.wrap.move/assert.engaged.cpp | 20 +
.../utilities/pointer_int_pair.pass.cpp | 37 +
.../functional.version.compile.pass.cpp | 32 +-
.../version.version.compile.pass.cpp | 32 +-
.../assignment/functor.pass.cpp | 84 ++
.../func.wrap.move/assignment/move.pass.cpp | 91 +++
.../assignment/move_other.pass.cpp | 62 ++
.../assignment/nullptr.pass.cpp | 73 ++
.../func.wrap.move/call/lvalue.pass.cpp | 102 +++
.../func.wrap.move/call/lvalue_const.pass.cpp | 118 +++
.../call/lvalue_const_noexcept.pass.cpp | 113 +++
.../call/lvalue_noexcept.pass.cpp | 102 +++
.../func.wrap.move/call/normal.pass.cpp | 106 +++
.../func.wrap.move/call/normal_const.pass.cpp | 112 +++
.../call/normal_const_noexcept.pass.cpp | 112 +++
.../call/normal_noexcept.pass.cpp | 106 +++
.../func.wrap.move/call/rvalue.pass.cpp | 104 +++
.../func.wrap.move/call/rvalue_const.pass.cpp | 107 +++
.../call/rvalue_const_noexcept.pass.cpp | 107 +++
.../call/rvalue_noexcept.pass.cpp | 104 +++
.../func.wrap/func.wrap.move/common.h | 80 ++
.../func.wrap.move/ctors/default.pass.cpp | 28 +
.../func.wrap.move/ctors/functor.pass.cpp | 115 +++
.../func.wrap.move/ctors/in_place.pass.cpp | 46 ++
.../ctors/in_place_init_list.pass.cpp | 46 ++
.../func.wrap.move/ctors/move.pass.cpp | 106 +++
.../func.wrap.move/ctors/move_other.pass.cpp | 44 ++
.../func.wrap.move/ctors/nullptr.pass.cpp | 28 +
.../func.wrap.move/swap.adl.pass.cpp | 73 ++
.../func.wrap.move/swap.member.pass.cpp | 73 ++
libcxx/test/support/type_algorithms.h | 36 +
.../generate_feature_test_macro_components.py | 1 -
46 files changed, 3469 insertions(+), 49 deletions(-)
create mode 100644 libcxx/include/__functional/move_only_function.h
create mode 100644 libcxx/include/__functional/move_only_function_common.h
create mode 100644 libcxx/include/__functional/move_only_function_impl.h
create mode 100644 libcxx/test/libcxx/private_headers.verify.cpp
create mode 100644 libcxx/test/libcxx/utilities/function.objects/func.wrap/func.wrap.move/assert.engaged.cpp
create mode 100644 libcxx/test/libcxx/utilities/pointer_int_pair.pass.cpp
create mode 100644 libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/assignment/functor.pass.cpp
create mode 100644 libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/assignment/move.pass.cpp
create mode 100644 libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/assignment/move_other.pass.cpp
create mode 100644 libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/assignment/nullptr.pass.cpp
create mode 100644 libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/lvalue.pass.cpp
create mode 100644 libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/lvalue_const.pass.cpp
create mode 100644 libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/lvalue_const_noexcept.pass.cpp
create mode 100644 libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/lvalue_noexcept.pass.cpp
create mode 100644 libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/normal.pass.cpp
create mode 100644 libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/normal_const.pass.cpp
create mode 100644 libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/normal_const_noexcept.pass.cpp
create mode 100644 libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/normal_noexcept.pass.cpp
create mode 100644 libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/rvalue.pass.cpp
create mode 100644 libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/rvalue_const.pass.cpp
create mode 100644 libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/rvalue_const_noexcept.pass.cpp
create mode 100644 libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/rvalue_noexcept.pass.cpp
create mode 100644 libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/common.h
create mode 100644 libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/default.pass.cpp
create mode 100644 libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/functor.pass.cpp
create mode 100644 libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/in_place.pass.cpp
create mode 100644 libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/in_place_init_list.pass.cpp
create mode 100644 libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/move.pass.cpp
create mode 100644 libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/move_other.pass.cpp
create mode 100644 libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/nullptr.pass.cpp
create mode 100644 libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/swap.adl.pass.cpp
create mode 100644 libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/swap.member.pass.cpp
diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst
index db24b65caca6c0..7cf485fbb354cd 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -348,7 +348,7 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_modules`` ``202207L``
---------------------------------------------------------- -----------------
- ``__cpp_lib_move_only_function`` *unimplemented*
+ ``__cpp_lib_move_only_function`` ``202110L``
---------------------------------------------------------- -----------------
``__cpp_lib_optional`` ``202110L``
---------------------------------------------------------- -----------------
@@ -498,4 +498,3 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_variant`` ``202306L``
========================================================== =================
-
diff --git a/libcxx/docs/ReleaseNotes/20.rst b/libcxx/docs/ReleaseNotes/20.rst
index bf3aafe6139ee9..cb8a322f79f391 100644
--- a/libcxx/docs/ReleaseNotes/20.rst
+++ b/libcxx/docs/ReleaseNotes/20.rst
@@ -45,6 +45,7 @@ Implemented Papers
- ``std::jthread`` and ``<stop_token>`` are not guarded behind ``-fexperimental-library`` anymore
- P2674R1: A trait for implicit lifetime types (`Github <https://github.com/llvm/llvm-project/issues/105259>`__)
- P0429R9: A Standard ``flat_map`` is partially implemented and ``flat_map`` is provided (`Github <https://github.com/llvm/llvm-project/issues/105190>`__)
+- P0288R9 - ``move_only_function``
Improvements and New Features
-----------------------------
diff --git a/libcxx/docs/Status/Cxx23Papers.csv b/libcxx/docs/Status/Cxx23Papers.csv
index 6f1626da73507e..43a9b9d213b667 100644
--- a/libcxx/docs/Status/Cxx23Papers.csv
+++ b/libcxx/docs/Status/Cxx23Papers.csv
@@ -23,7 +23,7 @@
"`P2136R3 <https://wg21.link/P2136R3>`__","invoke_r","2021-06 (Virtual)","|Complete|","17.0",""
"`P2166R1 <https://wg21.link/P2166R1>`__","A Proposal to Prohibit std::basic_string and std::basic_string_view construction from nullptr","2021-06 (Virtual)","|Complete|","13.0",""
"","","","","",""
-"`P0288R9 <https://wg21.link/P0288R9>`__","``any_invocable``","2021-10 (Virtual)","","",""
+"`P0288R9 <https://wg21.link/P0288R9>`__","LWG","``move_only_function``","October 2021","|Complete|","20.0"
"`P0798R8 <https://wg21.link/P0798R8>`__","Monadic operations for ``std::optional``","2021-10 (Virtual)","|Complete|","14.0",""
"`P0849R8 <https://wg21.link/P0849R8>`__","``auto(x)``: ``DECAY_COPY`` in the language","2021-10 (Virtual)","|Complete|","14.0",""
"`P1072R10 <https://wg21.link/P1072R10>`__","``basic_string::resize_and_overwrite``","2021-10 (Virtual)","|Complete|","14.0",""
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 3c0716b2d55d18..f99ef1aed3bea6 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -409,6 +409,9 @@ set(files
__functional/is_transparent.h
__functional/mem_fn.h
__functional/mem_fun_ref.h
+ __functional/move_only_function.h
+ __functional/move_only_function_common.h
+ __functional/move_only_function_impl.h
__functional/not_fn.h
__functional/operations.h
__functional/perfect_forward.h
diff --git a/libcxx/include/__configuration/abi.h b/libcxx/include/__configuration/abi.h
index 62c129f5921dee..287420f0927702 100644
--- a/libcxx/include/__configuration/abi.h
+++ b/libcxx/include/__configuration/abi.h
@@ -124,6 +124,8 @@
// This setting disables the addition of such artificial padding, leading to a more optimal
// representation for several types.
# define _LIBCPP_ABI_NO_COMPRESSED_PAIR_PADDING
+// Enable clang::trivial_abi for std::move_only_function
+# define _LIBCPP_ABI_SMALL_BUFFER_TRIVIAL_ABI
#elif _LIBCPP_ABI_VERSION == 1
# if !(defined(_LIBCPP_OBJECT_FORMAT_COFF) || defined(_LIBCPP_OBJECT_FORMAT_XCOFF))
// Enable compiling copies of now inline methods into the dylib to support
diff --git a/libcxx/include/__functional/move_only_function.h b/libcxx/include/__functional/move_only_function.h
new file mode 100644
index 00000000000000..98631f43201ab7
--- /dev/null
+++ b/libcxx/include/__functional/move_only_function.h
@@ -0,0 +1,97 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___FUNCTIONAL_MOVE_ONLY_FUNCTION_H
+#define _LIBCPP___FUNCTIONAL_MOVE_ONLY_FUNCTION_H
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER >= 23 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
+
+// move_only_function design:
+//
+// move_only_function has a small buffer with a size of `3 * sizeof(void*)` bytes. This buffer can only be used when the
+// object that should be stored is trivially relocatable (currently only when it is trivially move constructible and
+// trivially destructible). There is also a bool in the lower bits of the vptr stored which is set when the contained
+// object is not trivially destructible.
+//
+// trivially relocatable: It would also be possible to store nothrow_move_constructible types, but that would mean
+// that move_only_function itself would not be trivially relocatable anymore. The decision to keep move_only_function
+// trivially relocatable was made because we expect move_only_function to be mostly used to store a functor. To only
+// forward functors there is C++26's std::function_ref.
+//
+// buffer size: We did a survey of six implementations from various vendors. Three of them had a buffer size of 24 bytes
+// on 64 bit systems. This also allows storing a std::string or std::vector inside the small buffer (once the compiler
+// has full support of trivially_relocatable annotations).
+//
+// trivially-destructible bit: This allows us to keep the overall binary size smaller because we don't have to store
+// a pointer to a noop function inside the vtable. It also avoids loading the vtable during destruction, potentially
+// resulting in fewer cache misses. The downside is that calling the function now also requires setting the lower bits
+// of the pointer to zero, but this is a very fast operation on modern CPUs.
+//
+// interaction with copyable_function: When converting a copyable_function into a move_only_function we want to avoid
+// wrapping the copyable_function inside the move_only_function to avoid a double indirection. Instead, we copy the
+// small buffer and use copyable_function's vtable.
+
+// NOLINTBEGIN(readability-duplicate-include)
+# define _LIBCPP_IN_MOVE_ONLY_FUNCTION_H
+
+# include <__functional/move_only_function_impl.h>
+
+# define _LIBCPP_MOVE_ONLY_FUNCTION_REF &
+# include <__functional/move_only_function_impl.h>
+
+# define _LIBCPP_MOVE_ONLY_FUNCTION_REF &&
+# include <__functional/move_only_function_impl.h>
+
+# define _LIBCPP_MOVE_ONLY_FUNCTION_CV const
+# include <__functional/move_only_function_impl.h>
+
+# define _LIBCPP_MOVE_ONLY_FUNCTION_CV const
+# define _LIBCPP_MOVE_ONLY_FUNCTION_REF &
+# include <__functional/move_only_function_impl.h>
+
+# define _LIBCPP_MOVE_ONLY_FUNCTION_CV const
+# define _LIBCPP_MOVE_ONLY_FUNCTION_REF &&
+# include <__functional/move_only_function_impl.h>
+
+# define _LIBCPP_MOVE_ONLY_FUNCTION_NOEXCEPT true
+# include <__functional/move_only_function_impl.h>
+
+# define _LIBCPP_MOVE_ONLY_FUNCTION_NOEXCEPT true
+# define _LIBCPP_MOVE_ONLY_FUNCTION_REF &
+# include <__functional/move_only_function_impl.h>
+
+# define _LIBCPP_MOVE_ONLY_FUNCTION_NOEXCEPT true
+# define _LIBCPP_MOVE_ONLY_FUNCTION_REF &&
+# include <__functional/move_only_function_impl.h>
+
+# define _LIBCPP_MOVE_ONLY_FUNCTION_NOEXCEPT true
+# define _LIBCPP_MOVE_ONLY_FUNCTION_CV const
+# include <__functional/move_only_function_impl.h>
+
+# define _LIBCPP_MOVE_ONLY_FUNCTION_NOEXCEPT true
+# define _LIBCPP_MOVE_ONLY_FUNCTION_CV const
+# define _LIBCPP_MOVE_ONLY_FUNCTION_REF &
+# include <__functional/move_only_function_impl.h>
+
+# define _LIBCPP_MOVE_ONLY_FUNCTION_NOEXCEPT true
+# define _LIBCPP_MOVE_ONLY_FUNCTION_CV const
+# define _LIBCPP_MOVE_ONLY_FUNCTION_REF &&
+# include <__functional/move_only_function_impl.h>
+
+# undef _LIBCPP_IN_MOVE_ONLY_FUNCTION_H
+// NOLINTEND(readability-duplicate-include)
+
+#endif // _LIBCPP_STD_VER >= 23 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
+
+#endif // _LIBCPP___FUNCTIONAL_MOVE_ONLY_FUNCTION_H
diff --git a/libcxx/include/__functional/move_only_function_common.h b/libcxx/include/__functional/move_only_function_common.h
new file mode 100644
index 00000000000000..45978bfc91aadf
--- /dev/null
+++ b/libcxx/include/__functional/move_only_function_common.h
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___FUNCTIONAL_MOVE_ONLY_FUNCTION_COMMON_H
+#define _LIBCPP___FUNCTIONAL_MOVE_ONLY_FUNCTION_COMMON_H
+
+#include <__config>
+#include <__type_traits/integral_constant.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class...>
+class move_only_function;
+
+template <class>
+struct __is_move_only_function : false_type {};
+
+template <class... _Args>
+struct __is_move_only_function<move_only_function<_Args...>> : true_type {};
+
+template <class _BufferT, class _ReturnT, class... _ArgTypes>
+struct _MoveOnlyFunctionTrivialVTable {
+ using _CallFunc = _ReturnT(_BufferT&, _ArgTypes...);
+
+ _CallFunc* __call_;
+};
+
+template <class _BufferT, class _ReturnT, class... _ArgTypes>
+struct _MoveOnlyFunctionNonTrivialVTable : _MoveOnlyFunctionTrivialVTable<_BufferT, _ReturnT, _ArgTypes...> {
+ using _DestroyFunc = void(_BufferT&) noexcept;
+
+ _DestroyFunc* __destroy_;
+};
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___FUNCTIONAL_MOVE_ONLY_FUNCTION_COMMON_H
diff --git a/libcxx/include/__functional/move_only_function_impl.h b/libcxx/include/__functional/move_only_function_impl.h
new file mode 100644
index 00000000000000..bb959c3796182d
--- /dev/null
+++ b/libcxx/include/__functional/move_only_function_impl.h
@@ -0,0 +1,234 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// This header is unguarded on purpose. This header is an implementation detail of move_only_function.h
+// and generates multiple versions of std::move_only_function
+
+#include <__config>
+#include <__cstddef/nullptr_t.h>
+#include <__cstddef/size_t.h>
+#include <__functional/invoke.h>
+#include <__functional/move_only_function_common.h>
+#include <__type_traits/is_trivially_destructible.h>
+#include <__utility/exchange.h>
+#include <__utility/forward.h>
+#include <__utility/in_place.h>
+#include <__utility/move.h>
+#include <__utility/pointer_int_pair.h>
+#include <__utility/small_buffer.h>
+#include <__utility/swap.h>
+#include <cstring>
+#include <initializer_list>
+#include <new>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+#ifndef _LIBCPP_IN_MOVE_ONLY_FUNCTION_H
+# error This header should only be included from move_only_function.h
+#endif
+
+#ifndef _LIBCPP_MOVE_ONLY_FUNCTION_CV
+# define _LIBCPP_MOVE_ONLY_FUNCTION_CV
+#endif
+
+#ifndef _LIBCPP_MOVE_ONLY_FUNCTION_REF
+# define _LIBCPP_MOVE_ONLY_FUNCTION_REF
+# define _LIBCPP_MOVE_ONLY_FUNCTION_INVOKE_QUALS _LIBCPP_MOVE_ONLY_FUNCTION_CV&
+#else
+# define _LIBCPP_MOVE_ONLY_FUNCTION_INVOKE_QUALS _LIBCPP_MOVE_ONLY_FUNCTION_CV _LIBCPP_MOVE_ONLY_FUNCTION_REF
+#endif
+
+#ifndef _LIBCPP_MOVE_ONLY_FUNCTION_NOEXCEPT
+# define _LIBCPP_MOVE_ONLY_FUNCTION_NOEXCEPT false
+#endif
+
+#define _LIBCPP_MOVE_ONLY_FUNCTION_CVREF _LIBCPP_MOVE_ONLY_FUNCTION_CV _LIBCPP_MOVE_ONLY_FUNCTION_REF
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#ifdef _LIBCPP_ABI_MOVE_ONLY_FUNCTION_TRIVIAL_ABI
+# define _LIBCPP_MOVE_ONLY_FUNCTION_TRIVIAL_ABI [[_Clang::__trivial_abi__]]
+#else
+# define _LIBCPP_MOVE_ONLY_FUNCTION_TRIVIAL_ABI
+#endif
+
+template <class...>
+class move_only_function;
+
+template <class _ReturnT, class... _ArgTypes>
+class _LIBCPP_MOVE_ONLY_FUNCTION_TRIVIAL_ABI move_only_function<_ReturnT(
+ _ArgTypes...) _LIBCPP_MOVE_ONLY_FUNCTION_CVREF noexcept(_LIBCPP_MOVE_ONLY_FUNCTION_NOEXCEPT)> {
+private:
+ static constexpr size_t __buffer_size_ = 3 * sizeof(void*);
+ static constexpr size_t __buffer_alignment_ = alignof(void*);
+ using _BufferT = __small_buffer<__buffer_size_, __buffer_alignment_>;
+
+ using _TrivialVTable = _MoveOnlyFunctionTrivialVTable<_BufferT, _ReturnT, _ArgTypes...>;
+ using _NonTrivialVTable = _MoveOnlyFunctionNonTrivialVTable<_BufferT, _ReturnT, _ArgTypes...>;
+
+ template <class _Functor>
+ static constexpr _TrivialVTable __trivial_vtable_ = {
+ .__call_ = [](_BufferT& __buffer, _ArgTypes... __args) noexcept(_LIBCPP_MOVE_ONLY_FUNCTION_NOEXCEPT) -> _ReturnT {
+ return std::invoke_r<_ReturnT>(
+ static_cast<_Functor _LIBCPP_MOVE_ONLY_FUNCTION_INVOKE_QUALS>(*__buffer.__get<_Functor>()),
+ std::forward<_ArgTypes>(__args)...);
+ }};
+
+ template <class _Functor>
+ static constexpr _NonTrivialVTable __non_trivial_vtable_{
+ __trivial_vtable_<_Functor>,
+ [](_BufferT& __buffer) noexcept -> void {
+ std::destroy_at(__buffer.__get<_Functor>());
+ __buffer.__dealloc<_Functor>();
+ },
+ };
+
+ template <class _Functor>
+ _LIBCPP_HIDE_FROM_ABI __pointer_bool_pair<const _TrivialVTable*> __get_vptr() {
+ if constexpr (_BufferT::__fits_in_buffer<_Functor> && is_trivially_destructible_v<_Functor>) {
+ return {&__trivial_vtable_<_Functor>, false};
+ } else {
+ return {&__non_trivial_vtable_<_Functor>, true};
+ }
+ }
+
+ template <class _VT>
+ static constexpr bool __is_callable_from = [] {
+ using _DVT = decay_t<_VT>;
+ if (_LIBCPP_MOVE_ONLY_FUNCTION_NOEXCEPT) {
+ return is_nothrow_invocable_r_v<_ReturnT, _DVT _LIBCPP_MOVE_ONLY_FUNCTION_CVREF, _ArgTypes...> &&
+ is_nothrow_invocable_r_v<_ReturnT, _DVT _LIBCPP_MOVE_ONLY_FUNCTION_INVOKE_QUALS, _ArgTypes...>;
+ } else {
+ return is_invocable_r_v<_ReturnT, _DVT _LIBCPP_MOVE_ONLY_FUNCTION_CVREF, _ArgTypes...> &&
+ is_invocable_r_v<_ReturnT, _DVT _LIBCPP_MOVE_ONLY_FUNCTION_INVOKE_QUALS, _ArgTypes...>;
+ }
+ }();
+
+ template <class _Func, class... _Args>
+ _LIBCPP_HIDE_FROM_ABI void __construct(_Args&&... __args) {
+ static_assert(is_constructible_v<decay_t<_Func>, _Func>);
+
+ using _StoredFunc = decay_t<_Func>;
+ __vtable_ = __get_vptr<_StoredFunc>();
+ __buffer_.__construct<_StoredFunc>(std::forward<_Args>(__args)...);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI void __reset() noexcept {
+ if (__vtable_.__get_value())
+ static_cast<const _NonTrivialVTable*>(__vtable_.__get_ptr())->__destroy_(__buffer_);
+ __vtable_ = {};
+ }
+
+public:
+ using result_type = _ReturnT;
+
+ // [func.wrap.move.ctor]
+ move_only_function() noexcept = default;
+ _LIBCPP_HIDE_FROM_ABI move_only_function(nullptr_t) noexcept {}
+ _LIBCPP_HIDE_FROM_ABI move_only_function(move_only_function&& __other) noexcept
+ : __vtable_(__other.__vtable_), __buffer_(std::move(__other.__buffer_)) {
+ __other.__vtable_ = {};
+ }
+
+ template <class _Func>
+ requires(!is_same_v<remove_cvref_t<_Func>, move_only_function> && !__is_inplace_type<_Func>::value &&
+ __is_callable_from<_Func>)
+ _LIBCPP_HIDE_FROM_ABI move_only_function(_Func&& __func) noexcept {
+ using _StoredFunc = decay_t<_Func>;
+
+ if constexpr ((is_pointer_v<_StoredFunc> && is_function_v<remove_pointer_t<_StoredFunc>>) ||
+ is_member_function_pointer_v<_StoredFunc>) {
+ if (__func != nullptr) {
+ __vtable_ = __get_vptr<_StoredFunc>();
+ static_assert(_BufferT::__fits_in_buffer<_StoredFunc>);
+ __buffer_.__construct<_StoredFunc>(std::forward<_Func>(__func));
+ }
+ } else if constexpr (__is_move_only_function<_StoredFunc>::value) {
+ if (__func) {
+ __vtable_ = std::exchange(__func.__vtable_, {});
+ __buffer_ = std::move(__func.__buffer_);
+ }
+ } else {
+ __construct<_Func>(std::forward<_Func>(__func));
+ }
+ }
+
+ template <class _Func, class... _Args>
+ requires is_constructible_v<decay_t<_Func>, _Args...> && __is_callable_from<_Func>
+ _LIBCPP_HIDE_FROM_ABI explicit move_only_function(in_place_type_t<_Func>, _Args&&... __args) {
+ static_assert(is_same_v<decay_t<_Func>, _Func>);
+ __construct<_Func>(std::forward<_Args>(__args)...);
+ }
+
+ template <class _Func, class _InitListType, class... _Args>
+ requires is_constructible_v<decay_t<_Func>, initializer_list<_InitListType>&, _Args...> && __is_callable_from<_Func>
+ _LIBCPP_HIDE_FROM_ABI explicit move_only_function(
+ in_place_type_t<_Func>, initializer_list<_InitListType> __il, _Args&&... __args) {
+ static_assert(is_same_v<decay_t<_Func>, _Func>);
+ __construct<_Func>(__il, std::forward<_Args>(__args)...);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI move_only_function& operator=(move_only_function&& __other) noexcept {
+ move_only_function(std::move(__other)).swap(*this);
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI move_only_function& operator=(nullptr_t) noexcept {
+ __reset();
+ return *this;
+ }
+
+ template <class _Func>
+ requires(!is_same_v<remove_cvref_t<_Func>, move_only_function> && !__is_inplace_type<_Func>::value &&
+ __is_callable_from<_Func>)
+ _LIBCPP_HIDE_FROM_ABI move_only_function& operator=(_Func&& __func) {
+ move_only_function(std::forward<_Func>(__func)).swap(*this);
+ return *this;
+ }
+
+ _LIBCPP_HIDE_FROM_ABI ~move_only_function() { __reset(); }
+
+ // [func.wrap.move.inv]
+ _LIBCPP_HIDE_FROM_ABI explicit operator bool() const noexcept { return __vtable_.__get_ptr() != nullptr; }
+
+ _LIBCPP_HIDE_FROM_ABI _ReturnT operator()(_ArgTypes... __args) _LIBCPP_MOVE_ONLY_FUNCTION_CVREF
+ noexcept(_LIBCPP_MOVE_ONLY_FUNCTION_NOEXCEPT) {
+ _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(static_cast<bool>(*this), "Tried to call a disengaged move_only_function");
+ const auto __call = static_cast<_ReturnT (*)(_BufferT&, _ArgTypes...)>(__vtable_.__get_ptr()->__call_);
+ return __call(__buffer_, std::forward<_ArgTypes>(__args)...);
+ }
+
+ // [func.wrap.move.util]
+ _LIBCPP_HIDE_FROM_ABI void swap(move_only_function& __other) noexcept {
+ std::swap(__vtable_, __other.__vtable_);
+ std::swap(__buffer_, __other.__buffer_);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend void swap(move_only_function& __lhs, move_only_function& __rhs) noexcept {
+ __lhs.swap(__rhs);
+ }
+
+ _LIBCPP_HIDE_FROM_ABI friend bool operator==(const move_only_function& __func, nullptr_t) noexcept { return !__func; }
+
+private:
+ __pointer_bool_pair<const _TrivialVTable*> __vtable_ = {};
+ mutable _BufferT __buffer_;
+
+ template <class...>
+ friend class move_only_function;
+};
+
+#undef _LIBCPP_MOVE_ONLY_FUNCTION_CV
+#undef _LIBCPP_MOVE_ONLY_FUNCTION_REF
+#undef _LIBCPP_MOVE_ONLY_FUNCTION_NOEXCEPT
+#undef _LIBCPP_MOVE_ONLY_FUNCTION_INVOKE_QUALS
+#undef _LIBCPP_MOVE_ONLY_FUNCTION_CVREF
+
+_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__utility/pointer_int_pair.h b/libcxx/include/__utility/pointer_int_pair.h
index 5b8c2353b6b056..6dc7ecb35dc110 100644
--- a/libcxx/include/__utility/pointer_int_pair.h
+++ b/libcxx/include/__utility/pointer_int_pair.h
@@ -119,6 +119,9 @@ struct _PointerLikeTraits<__pointer_int_pair<_Pointer, _IntType, __int_bit_count
}
};
+template <class _Pointer>
+using __pointer_bool_pair = __pointer_int_pair<_Pointer, bool, __integer_width{1}>;
+
// Make __pointer_int_pair tuple-like
template <class _Pointer, class _IntType, __integer_width __int_bit_count>
diff --git a/libcxx/include/functional b/libcxx/include/functional
index 55b50eea84b732..589fec576e43cd 100644
--- a/libcxx/include/functional
+++ b/libcxx/include/functional
@@ -563,6 +563,10 @@ POLICY: For non-variadic implementations, the number of arguments is limited
# include <__type_traits/unwrap_ref.h>
#endif
+#if _LIBCPP_STD_VER >= 23
+# include <__functional/move_only_function.h>
+#endif
+
#include <version>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/module.modulemap b/libcxx/include/module.modulemap
index d0271469a248e4..c43c319fcbb0f6 100644
--- a/libcxx/include/module.modulemap
+++ b/libcxx/include/module.modulemap
@@ -1327,6 +1327,9 @@ module std [system] {
module is_transparent { header "__functional/is_transparent.h" }
module mem_fn { header "__functional/mem_fn.h" }
module mem_fun_ref { header "__functional/mem_fun_ref.h" }
+ module move_only_function { header "__functional/move_only_function.h" }
+ module move_only_function_common { header "__functional/move_only_function_common.h" }
+ module move_only_function_impl { textual header "__functional/move_only_function_impl.h" }
module not_fn {
header "__functional/not_fn.h"
export std.functional.perfect_forward // inherited from and using its operators
diff --git a/libcxx/include/version b/libcxx/include/version
index cb75f3b2db681c..8da33059d6c46f 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -487,7 +487,7 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_is_scoped_enum 202011L
# define __cpp_lib_mdspan 202207L
# define __cpp_lib_modules 202207L
-// # define __cpp_lib_move_only_function 202110L
+# define __cpp_lib_move_only_function 202110L
# undef __cpp_lib_optional
# define __cpp_lib_optional 202110L
# define __cpp_lib_out_ptr 202106L
diff --git a/libcxx/modules/std.cppm.in b/libcxx/modules/std.cppm.in
index b4889e5a69e49b..a5bb70e8b5a9a5 100644
--- a/libcxx/modules/std.cppm.in
+++ b/libcxx/modules/std.cppm.in
@@ -97,6 +97,7 @@ module;
#include <mdspan>
#include <memory>
#include <memory_resource>
+#include <module.modulemap.in>
#include <mutex>
#include <new>
#include <numbers>
diff --git a/libcxx/test/libcxx/private_headers.verify.cpp b/libcxx/test/libcxx/private_headers.verify.cpp
new file mode 100644
index 00000000000000..fc76655325720e
--- /dev/null
+++ b/libcxx/test/libcxx/private_headers.verify.cpp
@@ -0,0 +1,717 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// This test ensures that we produce a diagnostic when we use a private header
+// from user code.
+
+// REQUIRES: modules-build
+
+/*
+BEGIN-SCRIPT
+
+for header in private_headers:
+ # Skip headers that are not private yet in the modulemap
+ if header in private_headers_still_public_in_modules:
+ continue
+
+ # Skip private headers that start with __support -- those are not in the modulemap yet
+ if header.startswith('__support'):
+ continue
+
+ print("{ifdef}#{indent}include <{header}> // {expected_error}@*:* {{{{use of private header from outside its module: '{header}'}}}}{endif}".format(
+ ifdef='#if ' + header_restrictions[header] + '\n' if header in header_restrictions else '',
+ indent=' ' if header in header_restrictions else '',
+ header=header,
+ expected_error='expected-error',
+ endif='\n#endif' if header in header_restrictions else ''
+ ))
+
+END-SCRIPT
+*/
+
+// DO NOT MANUALLY EDIT ANYTHING BETWEEN THE MARKERS BELOW
+// GENERATED-MARKER
+#include <__algorithm/adjacent_find.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/adjacent_find.h'}}
+#include <__algorithm/all_of.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/all_of.h'}}
+#include <__algorithm/any_of.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/any_of.h'}}
+#include <__algorithm/binary_search.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/binary_search.h'}}
+#include <__algorithm/clamp.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/clamp.h'}}
+#include <__algorithm/comp.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/comp.h'}}
+#include <__algorithm/comp_ref_type.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/comp_ref_type.h'}}
+#include <__algorithm/copy.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/copy.h'}}
+#include <__algorithm/copy_backward.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/copy_backward.h'}}
+#include <__algorithm/copy_if.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/copy_if.h'}}
+#include <__algorithm/copy_n.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/copy_n.h'}}
+#include <__algorithm/count.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/count.h'}}
+#include <__algorithm/count_if.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/count_if.h'}}
+#include <__algorithm/equal.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/equal.h'}}
+#include <__algorithm/equal_range.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/equal_range.h'}}
+#include <__algorithm/fill.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/fill.h'}}
+#include <__algorithm/fill_n.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/fill_n.h'}}
+#include <__algorithm/find.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/find.h'}}
+#include <__algorithm/find_end.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/find_end.h'}}
+#include <__algorithm/find_first_of.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/find_first_of.h'}}
+#include <__algorithm/find_if.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/find_if.h'}}
+#include <__algorithm/find_if_not.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/find_if_not.h'}}
+#include <__algorithm/for_each.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/for_each.h'}}
+#include <__algorithm/for_each_n.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/for_each_n.h'}}
+#include <__algorithm/generate.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/generate.h'}}
+#include <__algorithm/generate_n.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/generate_n.h'}}
+#include <__algorithm/half_positive.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/half_positive.h'}}
+#include <__algorithm/in_found_result.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/in_found_result.h'}}
+#include <__algorithm/in_fun_result.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/in_fun_result.h'}}
+#include <__algorithm/in_in_out_result.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/in_in_out_result.h'}}
+#include <__algorithm/in_in_result.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/in_in_result.h'}}
+#include <__algorithm/in_out_out_result.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/in_out_out_result.h'}}
+#include <__algorithm/in_out_result.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/in_out_result.h'}}
+#include <__algorithm/includes.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/includes.h'}}
+#include <__algorithm/inplace_merge.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/inplace_merge.h'}}
+#include <__algorithm/is_heap.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/is_heap.h'}}
+#include <__algorithm/is_heap_until.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/is_heap_until.h'}}
+#include <__algorithm/is_partitioned.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/is_partitioned.h'}}
+#include <__algorithm/is_permutation.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/is_permutation.h'}}
+#include <__algorithm/is_sorted.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/is_sorted.h'}}
+#include <__algorithm/is_sorted_until.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/is_sorted_until.h'}}
+#include <__algorithm/iter_swap.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/iter_swap.h'}}
+#include <__algorithm/iterator_operations.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/iterator_operations.h'}}
+#include <__algorithm/lexicographical_compare.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/lexicographical_compare.h'}}
+#include <__algorithm/lower_bound.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/lower_bound.h'}}
+#include <__algorithm/make_heap.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/make_heap.h'}}
+#include <__algorithm/make_projected.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/make_projected.h'}}
+#include <__algorithm/max.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/max.h'}}
+#include <__algorithm/max_element.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/max_element.h'}}
+#include <__algorithm/merge.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/merge.h'}}
+#include <__algorithm/min.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/min.h'}}
+#include <__algorithm/min_element.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/min_element.h'}}
+#include <__algorithm/min_max_result.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/min_max_result.h'}}
+#include <__algorithm/minmax.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/minmax.h'}}
+#include <__algorithm/minmax_element.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/minmax_element.h'}}
+#include <__algorithm/mismatch.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/mismatch.h'}}
+#include <__algorithm/move.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/move.h'}}
+#include <__algorithm/move_backward.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/move_backward.h'}}
+#include <__algorithm/next_permutation.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/next_permutation.h'}}
+#include <__algorithm/none_of.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/none_of.h'}}
+#include <__algorithm/nth_element.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/nth_element.h'}}
+#include <__algorithm/partial_sort.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/partial_sort.h'}}
+#include <__algorithm/partial_sort_copy.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/partial_sort_copy.h'}}
+#include <__algorithm/partition.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/partition.h'}}
+#include <__algorithm/partition_copy.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/partition_copy.h'}}
+#include <__algorithm/partition_point.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/partition_point.h'}}
+#include <__algorithm/pop_heap.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/pop_heap.h'}}
+#include <__algorithm/prev_permutation.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/prev_permutation.h'}}
+#include <__algorithm/push_heap.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/push_heap.h'}}
+#include <__algorithm/ranges_adjacent_find.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_adjacent_find.h'}}
+#include <__algorithm/ranges_all_of.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_all_of.h'}}
+#include <__algorithm/ranges_any_of.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_any_of.h'}}
+#include <__algorithm/ranges_binary_search.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_binary_search.h'}}
+#include <__algorithm/ranges_clamp.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_clamp.h'}}
+#include <__algorithm/ranges_copy.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_copy.h'}}
+#include <__algorithm/ranges_copy_backward.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_copy_backward.h'}}
+#include <__algorithm/ranges_copy_if.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_copy_if.h'}}
+#include <__algorithm/ranges_copy_n.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_copy_n.h'}}
+#include <__algorithm/ranges_count.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_count.h'}}
+#include <__algorithm/ranges_count_if.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_count_if.h'}}
+#include <__algorithm/ranges_equal.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_equal.h'}}
+#include <__algorithm/ranges_equal_range.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_equal_range.h'}}
+#include <__algorithm/ranges_fill.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_fill.h'}}
+#include <__algorithm/ranges_fill_n.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_fill_n.h'}}
+#include <__algorithm/ranges_find.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_find.h'}}
+#include <__algorithm/ranges_find_end.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_find_end.h'}}
+#include <__algorithm/ranges_find_first_of.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_find_first_of.h'}}
+#include <__algorithm/ranges_find_if.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_find_if.h'}}
+#include <__algorithm/ranges_find_if_not.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_find_if_not.h'}}
+#include <__algorithm/ranges_for_each.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_for_each.h'}}
+#include <__algorithm/ranges_for_each_n.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_for_each_n.h'}}
+#include <__algorithm/ranges_generate.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_generate.h'}}
+#include <__algorithm/ranges_generate_n.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_generate_n.h'}}
+#include <__algorithm/ranges_includes.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_includes.h'}}
+#include <__algorithm/ranges_inplace_merge.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_inplace_merge.h'}}
+#include <__algorithm/ranges_is_heap.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_is_heap.h'}}
+#include <__algorithm/ranges_is_heap_until.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_is_heap_until.h'}}
+#include <__algorithm/ranges_is_partitioned.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_is_partitioned.h'}}
+#include <__algorithm/ranges_is_permutation.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_is_permutation.h'}}
+#include <__algorithm/ranges_is_sorted.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_is_sorted.h'}}
+#include <__algorithm/ranges_is_sorted_until.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_is_sorted_until.h'}}
+#include <__algorithm/ranges_iterator_concept.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_iterator_concept.h'}}
+#include <__algorithm/ranges_lexicographical_compare.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_lexicographical_compare.h'}}
+#include <__algorithm/ranges_lower_bound.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_lower_bound.h'}}
+#include <__algorithm/ranges_make_heap.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_make_heap.h'}}
+#include <__algorithm/ranges_max.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_max.h'}}
+#include <__algorithm/ranges_max_element.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_max_element.h'}}
+#include <__algorithm/ranges_merge.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_merge.h'}}
+#include <__algorithm/ranges_min.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_min.h'}}
+#include <__algorithm/ranges_min_element.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_min_element.h'}}
+#include <__algorithm/ranges_minmax.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_minmax.h'}}
+#include <__algorithm/ranges_minmax_element.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_minmax_element.h'}}
+#include <__algorithm/ranges_mismatch.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_mismatch.h'}}
+#include <__algorithm/ranges_move.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_move.h'}}
+#include <__algorithm/ranges_move_backward.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_move_backward.h'}}
+#include <__algorithm/ranges_next_permutation.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_next_permutation.h'}}
+#include <__algorithm/ranges_none_of.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_none_of.h'}}
+#include <__algorithm/ranges_nth_element.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_nth_element.h'}}
+#include <__algorithm/ranges_partial_sort.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_partial_sort.h'}}
+#include <__algorithm/ranges_partial_sort_copy.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_partial_sort_copy.h'}}
+#include <__algorithm/ranges_partition.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_partition.h'}}
+#include <__algorithm/ranges_partition_copy.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_partition_copy.h'}}
+#include <__algorithm/ranges_partition_point.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_partition_point.h'}}
+#include <__algorithm/ranges_pop_heap.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_pop_heap.h'}}
+#include <__algorithm/ranges_prev_permutation.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_prev_permutation.h'}}
+#include <__algorithm/ranges_push_heap.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_push_heap.h'}}
+#include <__algorithm/ranges_remove.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_remove.h'}}
+#include <__algorithm/ranges_remove_copy.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_remove_copy.h'}}
+#include <__algorithm/ranges_remove_copy_if.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_remove_copy_if.h'}}
+#include <__algorithm/ranges_remove_if.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_remove_if.h'}}
+#include <__algorithm/ranges_replace.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_replace.h'}}
+#include <__algorithm/ranges_replace_copy.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_replace_copy.h'}}
+#include <__algorithm/ranges_replace_copy_if.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_replace_copy_if.h'}}
+#include <__algorithm/ranges_replace_if.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_replace_if.h'}}
+#include <__algorithm/ranges_reverse.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_reverse.h'}}
+#include <__algorithm/ranges_reverse_copy.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_reverse_copy.h'}}
+#include <__algorithm/ranges_rotate.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_rotate.h'}}
+#include <__algorithm/ranges_rotate_copy.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_rotate_copy.h'}}
+#include <__algorithm/ranges_sample.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_sample.h'}}
+#include <__algorithm/ranges_search.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_search.h'}}
+#include <__algorithm/ranges_search_n.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_search_n.h'}}
+#include <__algorithm/ranges_set_difference.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_set_difference.h'}}
+#include <__algorithm/ranges_set_intersection.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_set_intersection.h'}}
+#include <__algorithm/ranges_set_symmetric_difference.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_set_symmetric_difference.h'}}
+#include <__algorithm/ranges_set_union.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_set_union.h'}}
+#include <__algorithm/ranges_shuffle.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_shuffle.h'}}
+#include <__algorithm/ranges_sort.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_sort.h'}}
+#include <__algorithm/ranges_sort_heap.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_sort_heap.h'}}
+#include <__algorithm/ranges_stable_partition.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_stable_partition.h'}}
+#include <__algorithm/ranges_stable_sort.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_stable_sort.h'}}
+#include <__algorithm/ranges_swap_ranges.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_swap_ranges.h'}}
+#include <__algorithm/ranges_transform.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_transform.h'}}
+#include <__algorithm/ranges_unique.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_unique.h'}}
+#include <__algorithm/ranges_unique_copy.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_unique_copy.h'}}
+#include <__algorithm/ranges_upper_bound.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/ranges_upper_bound.h'}}
+#include <__algorithm/remove.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/remove.h'}}
+#include <__algorithm/remove_copy.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/remove_copy.h'}}
+#include <__algorithm/remove_copy_if.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/remove_copy_if.h'}}
+#include <__algorithm/remove_if.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/remove_if.h'}}
+#include <__algorithm/replace.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/replace.h'}}
+#include <__algorithm/replace_copy.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/replace_copy.h'}}
+#include <__algorithm/replace_copy_if.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/replace_copy_if.h'}}
+#include <__algorithm/replace_if.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/replace_if.h'}}
+#include <__algorithm/reverse.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/reverse.h'}}
+#include <__algorithm/reverse_copy.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/reverse_copy.h'}}
+#include <__algorithm/rotate.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/rotate.h'}}
+#include <__algorithm/rotate_copy.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/rotate_copy.h'}}
+#include <__algorithm/sample.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/sample.h'}}
+#include <__algorithm/search.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/search.h'}}
+#include <__algorithm/search_n.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/search_n.h'}}
+#include <__algorithm/set_difference.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/set_difference.h'}}
+#include <__algorithm/set_intersection.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/set_intersection.h'}}
+#include <__algorithm/set_symmetric_difference.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/set_symmetric_difference.h'}}
+#include <__algorithm/set_union.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/set_union.h'}}
+#include <__algorithm/shift_left.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/shift_left.h'}}
+#include <__algorithm/shift_right.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/shift_right.h'}}
+#include <__algorithm/shuffle.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/shuffle.h'}}
+#include <__algorithm/sift_down.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/sift_down.h'}}
+#include <__algorithm/sort.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/sort.h'}}
+#include <__algorithm/sort_heap.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/sort_heap.h'}}
+#include <__algorithm/stable_partition.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/stable_partition.h'}}
+#include <__algorithm/stable_sort.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/stable_sort.h'}}
+#include <__algorithm/swap_ranges.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/swap_ranges.h'}}
+#include <__algorithm/transform.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/transform.h'}}
+#include <__algorithm/uniform_random_bit_generator_adaptor.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/uniform_random_bit_generator_adaptor.h'}}
+#include <__algorithm/unique.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/unique.h'}}
+#include <__algorithm/unique_copy.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/unique_copy.h'}}
+#include <__algorithm/unwrap_iter.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/unwrap_iter.h'}}
+#include <__algorithm/unwrap_range.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/unwrap_range.h'}}
+#include <__algorithm/upper_bound.h> // expected-error@*:* {{use of private header from outside its module: '__algorithm/upper_bound.h'}}
+#include <__availability> // expected-error@*:* {{use of private header from outside its module: '__availability'}}
+#include <__bit/bit_cast.h> // expected-error@*:* {{use of private header from outside its module: '__bit/bit_cast.h'}}
+#include <__bit/byteswap.h> // expected-error@*:* {{use of private header from outside its module: '__bit/byteswap.h'}}
+#include <__bit_reference> // expected-error@*:* {{use of private header from outside its module: '__bit_reference'}}
+#include <__bits> // expected-error@*:* {{use of private header from outside its module: '__bits'}}
+#include <__charconv/chars_format.h> // expected-error@*:* {{use of private header from outside its module: '__charconv/chars_format.h'}}
+#include <__charconv/from_chars_result.h> // expected-error@*:* {{use of private header from outside its module: '__charconv/from_chars_result.h'}}
+#include <__charconv/tables.h> // expected-error@*:* {{use of private header from outside its module: '__charconv/tables.h'}}
+#include <__charconv/to_chars_base_10.h> // expected-error@*:* {{use of private header from outside its module: '__charconv/to_chars_base_10.h'}}
+#include <__charconv/to_chars_result.h> // expected-error@*:* {{use of private header from outside its module: '__charconv/to_chars_result.h'}}
+#include <__chrono/calendar.h> // expected-error@*:* {{use of private header from outside its module: '__chrono/calendar.h'}}
+#include <__chrono/convert_to_timespec.h> // expected-error@*:* {{use of private header from outside its module: '__chrono/convert_to_timespec.h'}}
+#include <__chrono/convert_to_tm.h> // expected-error@*:* {{use of private header from outside its module: '__chrono/convert_to_tm.h'}}
+#include <__chrono/day.h> // expected-error@*:* {{use of private header from outside its module: '__chrono/day.h'}}
+#include <__chrono/duration.h> // expected-error@*:* {{use of private header from outside its module: '__chrono/duration.h'}}
+#include <__chrono/file_clock.h> // expected-error@*:* {{use of private header from outside its module: '__chrono/file_clock.h'}}
+#include <__chrono/formatter.h> // expected-error@*:* {{use of private header from outside its module: '__chrono/formatter.h'}}
+#include <__chrono/hh_mm_ss.h> // expected-error@*:* {{use of private header from outside its module: '__chrono/hh_mm_ss.h'}}
+#include <__chrono/high_resolution_clock.h> // expected-error@*:* {{use of private header from outside its module: '__chrono/high_resolution_clock.h'}}
+#include <__chrono/literals.h> // expected-error@*:* {{use of private header from outside its module: '__chrono/literals.h'}}
+#include <__chrono/month.h> // expected-error@*:* {{use of private header from outside its module: '__chrono/month.h'}}
+#include <__chrono/month_weekday.h> // expected-error@*:* {{use of private header from outside its module: '__chrono/month_weekday.h'}}
+#include <__chrono/monthday.h> // expected-error@*:* {{use of private header from outside its module: '__chrono/monthday.h'}}
+#include <__chrono/ostream.h> // expected-error@*:* {{use of private header from outside its module: '__chrono/ostream.h'}}
+#include <__chrono/parser_std_format_spec.h> // expected-error@*:* {{use of private header from outside its module: '__chrono/parser_std_format_spec.h'}}
+#include <__chrono/statically_widen.h> // expected-error@*:* {{use of private header from outside its module: '__chrono/statically_widen.h'}}
+#include <__chrono/steady_clock.h> // expected-error@*:* {{use of private header from outside its module: '__chrono/steady_clock.h'}}
+#include <__chrono/system_clock.h> // expected-error@*:* {{use of private header from outside its module: '__chrono/system_clock.h'}}
+#include <__chrono/time_point.h> // expected-error@*:* {{use of private header from outside its module: '__chrono/time_point.h'}}
+#include <__chrono/weekday.h> // expected-error@*:* {{use of private header from outside its module: '__chrono/weekday.h'}}
+#include <__chrono/year.h> // expected-error@*:* {{use of private header from outside its module: '__chrono/year.h'}}
+#include <__chrono/year_month.h> // expected-error@*:* {{use of private header from outside its module: '__chrono/year_month.h'}}
+#include <__chrono/year_month_day.h> // expected-error@*:* {{use of private header from outside its module: '__chrono/year_month_day.h'}}
+#include <__chrono/year_month_weekday.h> // expected-error@*:* {{use of private header from outside its module: '__chrono/year_month_weekday.h'}}
+#include <__compare/common_comparison_category.h> // expected-error@*:* {{use of private header from outside its module: '__compare/common_comparison_category.h'}}
+#include <__compare/compare_partial_order_fallback.h> // expected-error@*:* {{use of private header from outside its module: '__compare/compare_partial_order_fallback.h'}}
+#include <__compare/compare_strong_order_fallback.h> // expected-error@*:* {{use of private header from outside its module: '__compare/compare_strong_order_fallback.h'}}
+#include <__compare/compare_three_way.h> // expected-error@*:* {{use of private header from outside its module: '__compare/compare_three_way.h'}}
+#include <__compare/compare_three_way_result.h> // expected-error@*:* {{use of private header from outside its module: '__compare/compare_three_way_result.h'}}
+#include <__compare/compare_weak_order_fallback.h> // expected-error@*:* {{use of private header from outside its module: '__compare/compare_weak_order_fallback.h'}}
+#include <__compare/is_eq.h> // expected-error@*:* {{use of private header from outside its module: '__compare/is_eq.h'}}
+#include <__compare/ordering.h> // expected-error@*:* {{use of private header from outside its module: '__compare/ordering.h'}}
+#include <__compare/partial_order.h> // expected-error@*:* {{use of private header from outside its module: '__compare/partial_order.h'}}
+#include <__compare/strong_order.h> // expected-error@*:* {{use of private header from outside its module: '__compare/strong_order.h'}}
+#include <__compare/synth_three_way.h> // expected-error@*:* {{use of private header from outside its module: '__compare/synth_three_way.h'}}
+#include <__compare/three_way_comparable.h> // expected-error@*:* {{use of private header from outside its module: '__compare/three_way_comparable.h'}}
+#include <__compare/weak_order.h> // expected-error@*:* {{use of private header from outside its module: '__compare/weak_order.h'}}
+#include <__concepts/arithmetic.h> // expected-error@*:* {{use of private header from outside its module: '__concepts/arithmetic.h'}}
+#include <__concepts/assignable.h> // expected-error@*:* {{use of private header from outside its module: '__concepts/assignable.h'}}
+#include <__concepts/boolean_testable.h> // expected-error@*:* {{use of private header from outside its module: '__concepts/boolean_testable.h'}}
+#include <__concepts/class_or_enum.h> // expected-error@*:* {{use of private header from outside its module: '__concepts/class_or_enum.h'}}
+#include <__concepts/common_reference_with.h> // expected-error@*:* {{use of private header from outside its module: '__concepts/common_reference_with.h'}}
+#include <__concepts/common_with.h> // expected-error@*:* {{use of private header from outside its module: '__concepts/common_with.h'}}
+#include <__concepts/constructible.h> // expected-error@*:* {{use of private header from outside its module: '__concepts/constructible.h'}}
+#include <__concepts/convertible_to.h> // expected-error@*:* {{use of private header from outside its module: '__concepts/convertible_to.h'}}
+#include <__concepts/copyable.h> // expected-error@*:* {{use of private header from outside its module: '__concepts/copyable.h'}}
+#include <__concepts/derived_from.h> // expected-error@*:* {{use of private header from outside its module: '__concepts/derived_from.h'}}
+#include <__concepts/destructible.h> // expected-error@*:* {{use of private header from outside its module: '__concepts/destructible.h'}}
+#include <__concepts/different_from.h> // expected-error@*:* {{use of private header from outside its module: '__concepts/different_from.h'}}
+#include <__concepts/equality_comparable.h> // expected-error@*:* {{use of private header from outside its module: '__concepts/equality_comparable.h'}}
+#include <__concepts/invocable.h> // expected-error@*:* {{use of private header from outside its module: '__concepts/invocable.h'}}
+#include <__concepts/movable.h> // expected-error@*:* {{use of private header from outside its module: '__concepts/movable.h'}}
+#include <__concepts/predicate.h> // expected-error@*:* {{use of private header from outside its module: '__concepts/predicate.h'}}
+#include <__concepts/regular.h> // expected-error@*:* {{use of private header from outside its module: '__concepts/regular.h'}}
+#include <__concepts/relation.h> // expected-error@*:* {{use of private header from outside its module: '__concepts/relation.h'}}
+#include <__concepts/same_as.h> // expected-error@*:* {{use of private header from outside its module: '__concepts/same_as.h'}}
+#include <__concepts/semiregular.h> // expected-error@*:* {{use of private header from outside its module: '__concepts/semiregular.h'}}
+#include <__concepts/swappable.h> // expected-error@*:* {{use of private header from outside its module: '__concepts/swappable.h'}}
+#include <__concepts/totally_ordered.h> // expected-error@*:* {{use of private header from outside its module: '__concepts/totally_ordered.h'}}
+#include <__coroutine/coroutine_handle.h> // expected-error@*:* {{use of private header from outside its module: '__coroutine/coroutine_handle.h'}}
+#include <__coroutine/coroutine_traits.h> // expected-error@*:* {{use of private header from outside its module: '__coroutine/coroutine_traits.h'}}
+#include <__coroutine/noop_coroutine_handle.h> // expected-error@*:* {{use of private header from outside its module: '__coroutine/noop_coroutine_handle.h'}}
+#include <__coroutine/trivial_awaitables.h> // expected-error@*:* {{use of private header from outside its module: '__coroutine/trivial_awaitables.h'}}
+#include <__debug_utils/randomize_range.h> // expected-error@*:* {{use of private header from outside its module: '__debug_utils/randomize_range.h'}}
+#include <__errc> // expected-error@*:* {{use of private header from outside its module: '__errc'}}
+#include <__expected/bad_expected_access.h> // expected-error@*:* {{use of private header from outside its module: '__expected/bad_expected_access.h'}}
+#include <__expected/expected.h> // expected-error@*:* {{use of private header from outside its module: '__expected/expected.h'}}
+#include <__expected/unexpect.h> // expected-error@*:* {{use of private header from outside its module: '__expected/unexpect.h'}}
+#include <__expected/unexpected.h> // expected-error@*:* {{use of private header from outside its module: '__expected/unexpected.h'}}
+#include <__filesystem/copy_options.h> // expected-error@*:* {{use of private header from outside its module: '__filesystem/copy_options.h'}}
+#include <__filesystem/directory_entry.h> // expected-error@*:* {{use of private header from outside its module: '__filesystem/directory_entry.h'}}
+#include <__filesystem/directory_iterator.h> // expected-error@*:* {{use of private header from outside its module: '__filesystem/directory_iterator.h'}}
+#include <__filesystem/directory_options.h> // expected-error@*:* {{use of private header from outside its module: '__filesystem/directory_options.h'}}
+#include <__filesystem/file_status.h> // expected-error@*:* {{use of private header from outside its module: '__filesystem/file_status.h'}}
+#include <__filesystem/file_time_type.h> // expected-error@*:* {{use of private header from outside its module: '__filesystem/file_time_type.h'}}
+#include <__filesystem/file_type.h> // expected-error@*:* {{use of private header from outside its module: '__filesystem/file_type.h'}}
+#include <__filesystem/filesystem_error.h> // expected-error@*:* {{use of private header from outside its module: '__filesystem/filesystem_error.h'}}
+#include <__filesystem/operations.h> // expected-error@*:* {{use of private header from outside its module: '__filesystem/operations.h'}}
+#include <__filesystem/path.h> // expected-error@*:* {{use of private header from outside its module: '__filesystem/path.h'}}
+#include <__filesystem/path_iterator.h> // expected-error@*:* {{use of private header from outside its module: '__filesystem/path_iterator.h'}}
+#include <__filesystem/perm_options.h> // expected-error@*:* {{use of private header from outside its module: '__filesystem/perm_options.h'}}
+#include <__filesystem/perms.h> // expected-error@*:* {{use of private header from outside its module: '__filesystem/perms.h'}}
+#include <__filesystem/recursive_directory_iterator.h> // expected-error@*:* {{use of private header from outside its module: '__filesystem/recursive_directory_iterator.h'}}
+#include <__filesystem/space_info.h> // expected-error@*:* {{use of private header from outside its module: '__filesystem/space_info.h'}}
+#include <__filesystem/u8path.h> // expected-error@*:* {{use of private header from outside its module: '__filesystem/u8path.h'}}
+#include <__format/buffer.h> // expected-error@*:* {{use of private header from outside its module: '__format/buffer.h'}}
+#include <__format/concepts.h> // expected-error@*:* {{use of private header from outside its module: '__format/concepts.h'}}
+#include <__format/enable_insertable.h> // expected-error@*:* {{use of private header from outside its module: '__format/enable_insertable.h'}}
+#include <__format/escaped_output_table.h> // expected-error@*:* {{use of private header from outside its module: '__format/escaped_output_table.h'}}
+#include <__format/extended_grapheme_cluster_table.h> // expected-error@*:* {{use of private header from outside its module: '__format/extended_grapheme_cluster_table.h'}}
+#include <__format/format_arg.h> // expected-error@*:* {{use of private header from outside its module: '__format/format_arg.h'}}
+#include <__format/format_arg_store.h> // expected-error@*:* {{use of private header from outside its module: '__format/format_arg_store.h'}}
+#include <__format/format_args.h> // expected-error@*:* {{use of private header from outside its module: '__format/format_args.h'}}
+#include <__format/format_context.h> // expected-error@*:* {{use of private header from outside its module: '__format/format_context.h'}}
+#include <__format/format_error.h> // expected-error@*:* {{use of private header from outside its module: '__format/format_error.h'}}
+#include <__format/format_functions.h> // expected-error@*:* {{use of private header from outside its module: '__format/format_functions.h'}}
+#include <__format/format_fwd.h> // expected-error@*:* {{use of private header from outside its module: '__format/format_fwd.h'}}
+#include <__format/format_parse_context.h> // expected-error@*:* {{use of private header from outside its module: '__format/format_parse_context.h'}}
+#include <__format/format_string.h> // expected-error@*:* {{use of private header from outside its module: '__format/format_string.h'}}
+#include <__format/format_to_n_result.h> // expected-error@*:* {{use of private header from outside its module: '__format/format_to_n_result.h'}}
+#include <__format/formatter.h> // expected-error@*:* {{use of private header from outside its module: '__format/formatter.h'}}
+#include <__format/formatter_bool.h> // expected-error@*:* {{use of private header from outside its module: '__format/formatter_bool.h'}}
+#include <__format/formatter_char.h> // expected-error@*:* {{use of private header from outside its module: '__format/formatter_char.h'}}
+#include <__format/formatter_floating_point.h> // expected-error@*:* {{use of private header from outside its module: '__format/formatter_floating_point.h'}}
+#include <__format/formatter_integer.h> // expected-error@*:* {{use of private header from outside its module: '__format/formatter_integer.h'}}
+#include <__format/formatter_integral.h> // expected-error@*:* {{use of private header from outside its module: '__format/formatter_integral.h'}}
+#include <__format/formatter_output.h> // expected-error@*:* {{use of private header from outside its module: '__format/formatter_output.h'}}
+#include <__format/formatter_pointer.h> // expected-error@*:* {{use of private header from outside its module: '__format/formatter_pointer.h'}}
+#include <__format/formatter_string.h> // expected-error@*:* {{use of private header from outside its module: '__format/formatter_string.h'}}
+#include <__format/parser_std_format_spec.h> // expected-error@*:* {{use of private header from outside its module: '__format/parser_std_format_spec.h'}}
+#include <__format/range_default_formatter.h> // expected-error@*:* {{use of private header from outside its module: '__format/range_default_formatter.h'}}
+#include <__format/unicode.h> // expected-error@*:* {{use of private header from outside its module: '__format/unicode.h'}}
+#include <__functional/binary_function.h> // expected-error@*:* {{use of private header from outside its module: '__functional/binary_function.h'}}
+#include <__functional/binary_negate.h> // expected-error@*:* {{use of private header from outside its module: '__functional/binary_negate.h'}}
+#include <__functional/bind.h> // expected-error@*:* {{use of private header from outside its module: '__functional/bind.h'}}
+#include <__functional/bind_back.h> // expected-error@*:* {{use of private header from outside its module: '__functional/bind_back.h'}}
+#include <__functional/bind_front.h> // expected-error@*:* {{use of private header from outside its module: '__functional/bind_front.h'}}
+#include <__functional/binder1st.h> // expected-error@*:* {{use of private header from outside its module: '__functional/binder1st.h'}}
+#include <__functional/binder2nd.h> // expected-error@*:* {{use of private header from outside its module: '__functional/binder2nd.h'}}
+#include <__functional/boyer_moore_searcher.h> // expected-error@*:* {{use of private header from outside its module: '__functional/boyer_moore_searcher.h'}}
+#include <__functional/compose.h> // expected-error@*:* {{use of private header from outside its module: '__functional/compose.h'}}
+#include <__functional/default_searcher.h> // expected-error@*:* {{use of private header from outside its module: '__functional/default_searcher.h'}}
+#include <__functional/function.h> // expected-error@*:* {{use of private header from outside its module: '__functional/function.h'}}
+#include <__functional/hash.h> // expected-error@*:* {{use of private header from outside its module: '__functional/hash.h'}}
+#include <__functional/identity.h> // expected-error@*:* {{use of private header from outside its module: '__functional/identity.h'}}
+#include <__functional/invoke.h> // expected-error@*:* {{use of private header from outside its module: '__functional/invoke.h'}}
+#include <__functional/is_transparent.h> // expected-error@*:* {{use of private header from outside its module: '__functional/is_transparent.h'}}
+#include <__functional/mem_fn.h> // expected-error@*:* {{use of private header from outside its module: '__functional/mem_fn.h'}}
+#include <__functional/mem_fun_ref.h> // expected-error@*:* {{use of private header from outside its module: '__functional/mem_fun_ref.h'}}
+#include <__functional/move_only_function.h> // expected-error@*:* {{use of private header from outside its module: '__functional/move_only_function.h'}}
+#include <__functional/move_only_function_common.h> // expected-error@*:* {{use of private header from outside its module: '__functional/move_only_function_common.h'}}
+#include <__functional/move_only_function_impl.h> // expected-error@*:* {{use of private header from outside its module: '__functional/move_only_function_impl.h'}}
+#include <__functional/not_fn.h> // expected-error@*:* {{use of private header from outside its module: '__functional/not_fn.h'}}
+#include <__functional/operations.h> // expected-error@*:* {{use of private header from outside its module: '__functional/operations.h'}}
+#include <__functional/perfect_forward.h> // expected-error@*:* {{use of private header from outside its module: '__functional/perfect_forward.h'}}
+#include <__functional/pointer_to_binary_function.h> // expected-error@*:* {{use of private header from outside its module: '__functional/pointer_to_binary_function.h'}}
+#include <__functional/pointer_to_unary_function.h> // expected-error@*:* {{use of private header from outside its module: '__functional/pointer_to_unary_function.h'}}
+#include <__functional/ranges_operations.h> // expected-error@*:* {{use of private header from outside its module: '__functional/ranges_operations.h'}}
+#include <__functional/reference_wrapper.h> // expected-error@*:* {{use of private header from outside its module: '__functional/reference_wrapper.h'}}
+#include <__functional/unary_function.h> // expected-error@*:* {{use of private header from outside its module: '__functional/unary_function.h'}}
+#include <__functional/unary_negate.h> // expected-error@*:* {{use of private header from outside its module: '__functional/unary_negate.h'}}
+#include <__functional/unwrap_ref.h> // expected-error@*:* {{use of private header from outside its module: '__functional/unwrap_ref.h'}}
+#include <__functional/weak_result_type.h> // expected-error@*:* {{use of private header from outside its module: '__functional/weak_result_type.h'}}
+#include <__fwd/array.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/array.h'}}
+#include <__fwd/get.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/get.h'}}
+#include <__fwd/hash.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/hash.h'}}
+#include <__fwd/memory_resource.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/memory_resource.h'}}
+#include <__fwd/pair.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/pair.h'}}
+#include <__fwd/span.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/span.h'}}
+#include <__fwd/string.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/string.h'}}
+#include <__fwd/string_view.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/string_view.h'}}
+#include <__fwd/tuple.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/tuple.h'}}
+#include <__ios/fpos.h> // expected-error@*:* {{use of private header from outside its module: '__ios/fpos.h'}}
+#include <__iterator/access.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/access.h'}}
+#include <__iterator/advance.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/advance.h'}}
+#include <__iterator/back_insert_iterator.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/back_insert_iterator.h'}}
+#include <__iterator/bounded_iter.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/bounded_iter.h'}}
+#include <__iterator/common_iterator.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/common_iterator.h'}}
+#include <__iterator/concepts.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/concepts.h'}}
+#include <__iterator/counted_iterator.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/counted_iterator.h'}}
+#include <__iterator/data.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/data.h'}}
+#include <__iterator/default_sentinel.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/default_sentinel.h'}}
+#include <__iterator/distance.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/distance.h'}}
+#include <__iterator/empty.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/empty.h'}}
+#include <__iterator/erase_if_container.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/erase_if_container.h'}}
+#include <__iterator/front_insert_iterator.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/front_insert_iterator.h'}}
+#include <__iterator/incrementable_traits.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/incrementable_traits.h'}}
+#include <__iterator/indirectly_comparable.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/indirectly_comparable.h'}}
+#include <__iterator/insert_iterator.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/insert_iterator.h'}}
+#include <__iterator/istream_iterator.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/istream_iterator.h'}}
+#include <__iterator/istreambuf_iterator.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/istreambuf_iterator.h'}}
+#include <__iterator/iter_move.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/iter_move.h'}}
+#include <__iterator/iter_swap.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/iter_swap.h'}}
+#include <__iterator/iterator.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/iterator.h'}}
+#include <__iterator/iterator_traits.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/iterator_traits.h'}}
+#include <__iterator/mergeable.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/mergeable.h'}}
+#include <__iterator/move_iterator.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/move_iterator.h'}}
+#include <__iterator/move_sentinel.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/move_sentinel.h'}}
+#include <__iterator/next.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/next.h'}}
+#include <__iterator/ostream_iterator.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/ostream_iterator.h'}}
+#include <__iterator/ostreambuf_iterator.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/ostreambuf_iterator.h'}}
+#include <__iterator/permutable.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/permutable.h'}}
+#include <__iterator/prev.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/prev.h'}}
+#include <__iterator/projected.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/projected.h'}}
+#include <__iterator/readable_traits.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/readable_traits.h'}}
+#include <__iterator/reverse_access.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/reverse_access.h'}}
+#include <__iterator/reverse_iterator.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/reverse_iterator.h'}}
+#include <__iterator/size.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/size.h'}}
+#include <__iterator/sortable.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/sortable.h'}}
+#include <__iterator/unreachable_sentinel.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/unreachable_sentinel.h'}}
+#include <__iterator/wrap_iter.h> // expected-error@*:* {{use of private header from outside its module: '__iterator/wrap_iter.h'}}
+#include <__locale> // expected-error@*:* {{use of private header from outside its module: '__locale'}}
+#include <__mbstate_t.h> // expected-error@*:* {{use of private header from outside its module: '__mbstate_t.h'}}
+#include <__memory/addressof.h> // expected-error@*:* {{use of private header from outside its module: '__memory/addressof.h'}}
+#include <__memory/align.h> // expected-error@*:* {{use of private header from outside its module: '__memory/align.h'}}
+#include <__memory/allocate_at_least.h> // expected-error@*:* {{use of private header from outside its module: '__memory/allocate_at_least.h'}}
+#include <__memory/allocation_guard.h> // expected-error@*:* {{use of private header from outside its module: '__memory/allocation_guard.h'}}
+#include <__memory/allocator.h> // expected-error@*:* {{use of private header from outside its module: '__memory/allocator.h'}}
+#include <__memory/allocator_arg_t.h> // expected-error@*:* {{use of private header from outside its module: '__memory/allocator_arg_t.h'}}
+#include <__memory/allocator_destructor.h> // expected-error@*:* {{use of private header from outside its module: '__memory/allocator_destructor.h'}}
+#include <__memory/allocator_traits.h> // expected-error@*:* {{use of private header from outside its module: '__memory/allocator_traits.h'}}
+#include <__memory/assume_aligned.h> // expected-error@*:* {{use of private header from outside its module: '__memory/assume_aligned.h'}}
+#include <__memory/auto_ptr.h> // expected-error@*:* {{use of private header from outside its module: '__memory/auto_ptr.h'}}
+#include <__memory/builtin_new_allocator.h> // expected-error@*:* {{use of private header from outside its module: '__memory/builtin_new_allocator.h'}}
+#include <__memory/compressed_pair.h> // expected-error@*:* {{use of private header from outside its module: '__memory/compressed_pair.h'}}
+#include <__memory/concepts.h> // expected-error@*:* {{use of private header from outside its module: '__memory/concepts.h'}}
+#include <__memory/construct_at.h> // expected-error@*:* {{use of private header from outside its module: '__memory/construct_at.h'}}
+#include <__memory/destruct_n.h> // expected-error@*:* {{use of private header from outside its module: '__memory/destruct_n.h'}}
+#include <__memory/pointer_traits.h> // expected-error@*:* {{use of private header from outside its module: '__memory/pointer_traits.h'}}
+#include <__memory/ranges_construct_at.h> // expected-error@*:* {{use of private header from outside its module: '__memory/ranges_construct_at.h'}}
+#include <__memory/ranges_uninitialized_algorithms.h> // expected-error@*:* {{use of private header from outside its module: '__memory/ranges_uninitialized_algorithms.h'}}
+#include <__memory/raw_storage_iterator.h> // expected-error@*:* {{use of private header from outside its module: '__memory/raw_storage_iterator.h'}}
+#include <__memory/shared_ptr.h> // expected-error@*:* {{use of private header from outside its module: '__memory/shared_ptr.h'}}
+#include <__memory/swap_allocator.h> // expected-error@*:* {{use of private header from outside its module: '__memory/swap_allocator.h'}}
+#include <__memory/temp_value.h> // expected-error@*:* {{use of private header from outside its module: '__memory/temp_value.h'}}
+#include <__memory/temporary_buffer.h> // expected-error@*:* {{use of private header from outside its module: '__memory/temporary_buffer.h'}}
+#include <__memory/uninitialized_algorithms.h> // expected-error@*:* {{use of private header from outside its module: '__memory/uninitialized_algorithms.h'}}
+#include <__memory/unique_ptr.h> // expected-error@*:* {{use of private header from outside its module: '__memory/unique_ptr.h'}}
+#include <__memory/uses_allocator.h> // expected-error@*:* {{use of private header from outside its module: '__memory/uses_allocator.h'}}
+#include <__memory/uses_allocator_construction.h> // expected-error@*:* {{use of private header from outside its module: '__memory/uses_allocator_construction.h'}}
+#include <__memory/voidify.h> // expected-error@*:* {{use of private header from outside its module: '__memory/voidify.h'}}
+#include <__memory_resource/memory_resource.h> // expected-error@*:* {{use of private header from outside its module: '__memory_resource/memory_resource.h'}}
+#include <__memory_resource/monotonic_buffer_resource.h> // expected-error@*:* {{use of private header from outside its module: '__memory_resource/monotonic_buffer_resource.h'}}
+#include <__memory_resource/polymorphic_allocator.h> // expected-error@*:* {{use of private header from outside its module: '__memory_resource/polymorphic_allocator.h'}}
+#include <__memory_resource/pool_options.h> // expected-error@*:* {{use of private header from outside its module: '__memory_resource/pool_options.h'}}
+#include <__memory_resource/synchronized_pool_resource.h> // expected-error@*:* {{use of private header from outside its module: '__memory_resource/synchronized_pool_resource.h'}}
+#include <__memory_resource/unsynchronized_pool_resource.h> // expected-error@*:* {{use of private header from outside its module: '__memory_resource/unsynchronized_pool_resource.h'}}
+#include <__mutex_base> // expected-error@*:* {{use of private header from outside its module: '__mutex_base'}}
+#include <__node_handle> // expected-error@*:* {{use of private header from outside its module: '__node_handle'}}
+#include <__numeric/accumulate.h> // expected-error@*:* {{use of private header from outside its module: '__numeric/accumulate.h'}}
+#include <__numeric/adjacent_difference.h> // expected-error@*:* {{use of private header from outside its module: '__numeric/adjacent_difference.h'}}
+#include <__numeric/exclusive_scan.h> // expected-error@*:* {{use of private header from outside its module: '__numeric/exclusive_scan.h'}}
+#include <__numeric/gcd_lcm.h> // expected-error@*:* {{use of private header from outside its module: '__numeric/gcd_lcm.h'}}
+#include <__numeric/inclusive_scan.h> // expected-error@*:* {{use of private header from outside its module: '__numeric/inclusive_scan.h'}}
+#include <__numeric/inner_product.h> // expected-error@*:* {{use of private header from outside its module: '__numeric/inner_product.h'}}
+#include <__numeric/iota.h> // expected-error@*:* {{use of private header from outside its module: '__numeric/iota.h'}}
+#include <__numeric/midpoint.h> // expected-error@*:* {{use of private header from outside its module: '__numeric/midpoint.h'}}
+#include <__numeric/partial_sum.h> // expected-error@*:* {{use of private header from outside its module: '__numeric/partial_sum.h'}}
+#include <__numeric/reduce.h> // expected-error@*:* {{use of private header from outside its module: '__numeric/reduce.h'}}
+#include <__numeric/transform_exclusive_scan.h> // expected-error@*:* {{use of private header from outside its module: '__numeric/transform_exclusive_scan.h'}}
+#include <__numeric/transform_inclusive_scan.h> // expected-error@*:* {{use of private header from outside its module: '__numeric/transform_inclusive_scan.h'}}
+#include <__numeric/transform_reduce.h> // expected-error@*:* {{use of private header from outside its module: '__numeric/transform_reduce.h'}}
+#include <__random/bernoulli_distribution.h> // expected-error@*:* {{use of private header from outside its module: '__random/bernoulli_distribution.h'}}
+#include <__random/binomial_distribution.h> // expected-error@*:* {{use of private header from outside its module: '__random/binomial_distribution.h'}}
+#include <__random/cauchy_distribution.h> // expected-error@*:* {{use of private header from outside its module: '__random/cauchy_distribution.h'}}
+#include <__random/chi_squared_distribution.h> // expected-error@*:* {{use of private header from outside its module: '__random/chi_squared_distribution.h'}}
+#include <__random/clamp_to_integral.h> // expected-error@*:* {{use of private header from outside its module: '__random/clamp_to_integral.h'}}
+#include <__random/default_random_engine.h> // expected-error@*:* {{use of private header from outside its module: '__random/default_random_engine.h'}}
+#include <__random/discard_block_engine.h> // expected-error@*:* {{use of private header from outside its module: '__random/discard_block_engine.h'}}
+#include <__random/discrete_distribution.h> // expected-error@*:* {{use of private header from outside its module: '__random/discrete_distribution.h'}}
+#include <__random/exponential_distribution.h> // expected-error@*:* {{use of private header from outside its module: '__random/exponential_distribution.h'}}
+#include <__random/extreme_value_distribution.h> // expected-error@*:* {{use of private header from outside its module: '__random/extreme_value_distribution.h'}}
+#include <__random/fisher_f_distribution.h> // expected-error@*:* {{use of private header from outside its module: '__random/fisher_f_distribution.h'}}
+#include <__random/gamma_distribution.h> // expected-error@*:* {{use of private header from outside its module: '__random/gamma_distribution.h'}}
+#include <__random/generate_canonical.h> // expected-error@*:* {{use of private header from outside its module: '__random/generate_canonical.h'}}
+#include <__random/geometric_distribution.h> // expected-error@*:* {{use of private header from outside its module: '__random/geometric_distribution.h'}}
+#include <__random/independent_bits_engine.h> // expected-error@*:* {{use of private header from outside its module: '__random/independent_bits_engine.h'}}
+#include <__random/is_seed_sequence.h> // expected-error@*:* {{use of private header from outside its module: '__random/is_seed_sequence.h'}}
+#include <__random/is_valid.h> // expected-error@*:* {{use of private header from outside its module: '__random/is_valid.h'}}
+#include <__random/knuth_b.h> // expected-error@*:* {{use of private header from outside its module: '__random/knuth_b.h'}}
+#include <__random/linear_congruential_engine.h> // expected-error@*:* {{use of private header from outside its module: '__random/linear_congruential_engine.h'}}
+#include <__random/log2.h> // expected-error@*:* {{use of private header from outside its module: '__random/log2.h'}}
+#include <__random/lognormal_distribution.h> // expected-error@*:* {{use of private header from outside its module: '__random/lognormal_distribution.h'}}
+#include <__random/mersenne_twister_engine.h> // expected-error@*:* {{use of private header from outside its module: '__random/mersenne_twister_engine.h'}}
+#include <__random/negative_binomial_distribution.h> // expected-error@*:* {{use of private header from outside its module: '__random/negative_binomial_distribution.h'}}
+#include <__random/normal_distribution.h> // expected-error@*:* {{use of private header from outside its module: '__random/normal_distribution.h'}}
+#include <__random/piecewise_constant_distribution.h> // expected-error@*:* {{use of private header from outside its module: '__random/piecewise_constant_distribution.h'}}
+#include <__random/piecewise_linear_distribution.h> // expected-error@*:* {{use of private header from outside its module: '__random/piecewise_linear_distribution.h'}}
+#include <__random/poisson_distribution.h> // expected-error@*:* {{use of private header from outside its module: '__random/poisson_distribution.h'}}
+#include <__random/random_device.h> // expected-error@*:* {{use of private header from outside its module: '__random/random_device.h'}}
+#include <__random/ranlux.h> // expected-error@*:* {{use of private header from outside its module: '__random/ranlux.h'}}
+#include <__random/seed_seq.h> // expected-error@*:* {{use of private header from outside its module: '__random/seed_seq.h'}}
+#include <__random/shuffle_order_engine.h> // expected-error@*:* {{use of private header from outside its module: '__random/shuffle_order_engine.h'}}
+#include <__random/student_t_distribution.h> // expected-error@*:* {{use of private header from outside its module: '__random/student_t_distribution.h'}}
+#include <__random/subtract_with_carry_engine.h> // expected-error@*:* {{use of private header from outside its module: '__random/subtract_with_carry_engine.h'}}
+#include <__random/uniform_int_distribution.h> // expected-error@*:* {{use of private header from outside its module: '__random/uniform_int_distribution.h'}}
+#include <__random/uniform_random_bit_generator.h> // expected-error@*:* {{use of private header from outside its module: '__random/uniform_random_bit_generator.h'}}
+#include <__random/uniform_real_distribution.h> // expected-error@*:* {{use of private header from outside its module: '__random/uniform_real_distribution.h'}}
+#include <__random/weibull_distribution.h> // expected-error@*:* {{use of private header from outside its module: '__random/weibull_distribution.h'}}
+#include <__ranges/access.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/access.h'}}
+#include <__ranges/all.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/all.h'}}
+#include <__ranges/common_view.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/common_view.h'}}
+#include <__ranges/concepts.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/concepts.h'}}
+#include <__ranges/copyable_box.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/copyable_box.h'}}
+#include <__ranges/counted.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/counted.h'}}
+#include <__ranges/dangling.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/dangling.h'}}
+#include <__ranges/data.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/data.h'}}
+#include <__ranges/drop_view.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/drop_view.h'}}
+#include <__ranges/drop_while_view.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/drop_while_view.h'}}
+#include <__ranges/empty.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/empty.h'}}
+#include <__ranges/empty_view.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/empty_view.h'}}
+#include <__ranges/enable_borrowed_range.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/enable_borrowed_range.h'}}
+#include <__ranges/enable_view.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/enable_view.h'}}
+#include <__ranges/filter_view.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/filter_view.h'}}
+#include <__ranges/iota_view.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/iota_view.h'}}
+#include <__ranges/istream_view.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/istream_view.h'}}
+#include <__ranges/join_view.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/join_view.h'}}
+#include <__ranges/lazy_split_view.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/lazy_split_view.h'}}
+#include <__ranges/non_propagating_cache.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/non_propagating_cache.h'}}
+#include <__ranges/owning_view.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/owning_view.h'}}
+#include <__ranges/range_adaptor.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/range_adaptor.h'}}
+#include <__ranges/rbegin.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/rbegin.h'}}
+#include <__ranges/ref_view.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/ref_view.h'}}
+#include <__ranges/rend.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/rend.h'}}
+#include <__ranges/reverse_view.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/reverse_view.h'}}
+#include <__ranges/single_view.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/single_view.h'}}
+#include <__ranges/size.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/size.h'}}
+#include <__ranges/subrange.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/subrange.h'}}
+#include <__ranges/take_view.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/take_view.h'}}
+#include <__ranges/take_while_view.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/take_while_view.h'}}
+#include <__ranges/transform_view.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/transform_view.h'}}
+#include <__ranges/view_interface.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/view_interface.h'}}
+#include <__ranges/views.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/views.h'}}
+#include <__ranges/zip_view.h> // expected-error@*:* {{use of private header from outside its module: '__ranges/zip_view.h'}}
+#include <__split_buffer> // expected-error@*:* {{use of private header from outside its module: '__split_buffer'}}
+#include <__std_stream> // expected-error@*:* {{use of private header from outside its module: '__std_stream'}}
+#include <__string/char_traits.h> // expected-error@*:* {{use of private header from outside its module: '__string/char_traits.h'}}
+#include <__string/extern_template_lists.h> // expected-error@*:* {{use of private header from outside its module: '__string/extern_template_lists.h'}}
+#include <__thread/poll_with_backoff.h> // expected-error@*:* {{use of private header from outside its module: '__thread/poll_with_backoff.h'}}
+#include <__thread/timed_backoff_policy.h> // expected-error@*:* {{use of private header from outside its module: '__thread/timed_backoff_policy.h'}}
+#include <__tuple/apply_cv.h> // expected-error@*:* {{use of private header from outside its module: '__tuple/apply_cv.h'}}
+#include <__tuple/make_tuple_types.h> // expected-error@*:* {{use of private header from outside its module: '__tuple/make_tuple_types.h'}}
+#include <__tuple/sfinae_helpers.h> // expected-error@*:* {{use of private header from outside its module: '__tuple/sfinae_helpers.h'}}
+#include <__tuple/tuple_element.h> // expected-error@*:* {{use of private header from outside its module: '__tuple/tuple_element.h'}}
+#include <__tuple/tuple_indices.h> // expected-error@*:* {{use of private header from outside its module: '__tuple/tuple_indices.h'}}
+#include <__tuple/tuple_like.h> // expected-error@*:* {{use of private header from outside its module: '__tuple/tuple_like.h'}}
+#include <__tuple/tuple_size.h> // expected-error@*:* {{use of private header from outside its module: '__tuple/tuple_size.h'}}
+#include <__tuple/tuple_types.h> // expected-error@*:* {{use of private header from outside its module: '__tuple/tuple_types.h'}}
+#include <__type_traits/add_const.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/add_const.h'}}
+#include <__type_traits/add_cv.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/add_cv.h'}}
+#include <__type_traits/add_lvalue_reference.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/add_lvalue_reference.h'}}
+#include <__type_traits/add_pointer.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/add_pointer.h'}}
+#include <__type_traits/add_rvalue_reference.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/add_rvalue_reference.h'}}
+#include <__type_traits/add_volatile.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/add_volatile.h'}}
+#include <__type_traits/aligned_storage.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/aligned_storage.h'}}
+#include <__type_traits/aligned_union.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/aligned_union.h'}}
+#include <__type_traits/alignment_of.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/alignment_of.h'}}
+#include <__type_traits/apply_cv.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/apply_cv.h'}}
+#include <__type_traits/can_extract_key.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/can_extract_key.h'}}
+#include <__type_traits/common_reference.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/common_reference.h'}}
+#include <__type_traits/common_type.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/common_type.h'}}
+#include <__type_traits/conditional.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/conditional.h'}}
+#include <__type_traits/conjunction.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/conjunction.h'}}
+#include <__type_traits/copy_cv.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/copy_cv.h'}}
+#include <__type_traits/copy_cvref.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/copy_cvref.h'}}
+#include <__type_traits/decay.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/decay.h'}}
+#include <__type_traits/dependent_type.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/dependent_type.h'}}
+#include <__type_traits/disjunction.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/disjunction.h'}}
+#include <__type_traits/enable_if.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/enable_if.h'}}
+#include <__type_traits/extent.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/extent.h'}}
+#include <__type_traits/has_unique_object_representation.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/has_unique_object_representation.h'}}
+#include <__type_traits/has_virtual_destructor.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/has_virtual_destructor.h'}}
+#include <__type_traits/integral_constant.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/integral_constant.h'}}
+#include <__type_traits/is_abstract.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_abstract.h'}}
+#include <__type_traits/is_aggregate.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_aggregate.h'}}
+#include <__type_traits/is_allocator.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_allocator.h'}}
+#include <__type_traits/is_arithmetic.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_arithmetic.h'}}
+#include <__type_traits/is_array.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_array.h'}}
+#include <__type_traits/is_assignable.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_assignable.h'}}
+#include <__type_traits/is_base_of.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_base_of.h'}}
+#include <__type_traits/is_bounded_array.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_bounded_array.h'}}
+#include <__type_traits/is_callable.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_callable.h'}}
+#include <__type_traits/is_char_like_type.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_char_like_type.h'}}
+#include <__type_traits/is_class.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_class.h'}}
+#include <__type_traits/is_compound.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_compound.h'}}
+#include <__type_traits/is_const.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_const.h'}}
+#include <__type_traits/is_constant_evaluated.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_constant_evaluated.h'}}
+#include <__type_traits/is_constructible.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_constructible.h'}}
+#include <__type_traits/is_convertible.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_convertible.h'}}
+#include <__type_traits/is_copy_assignable.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_copy_assignable.h'}}
+#include <__type_traits/is_copy_constructible.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_copy_constructible.h'}}
+#include <__type_traits/is_core_convertible.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_core_convertible.h'}}
+#include <__type_traits/is_default_constructible.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_default_constructible.h'}}
+#include <__type_traits/is_destructible.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_destructible.h'}}
+#include <__type_traits/is_empty.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_empty.h'}}
+#include <__type_traits/is_enum.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_enum.h'}}
+#include <__type_traits/is_final.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_final.h'}}
+#include <__type_traits/is_floating_point.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_floating_point.h'}}
+#include <__type_traits/is_function.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_function.h'}}
+#include <__type_traits/is_fundamental.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_fundamental.h'}}
+#include <__type_traits/is_implicitly_default_constructible.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_implicitly_default_constructible.h'}}
+#include <__type_traits/is_integral.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_integral.h'}}
+#include <__type_traits/is_literal_type.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_literal_type.h'}}
+#include <__type_traits/is_member_function_pointer.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_member_function_pointer.h'}}
+#include <__type_traits/is_member_object_pointer.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_member_object_pointer.h'}}
+#include <__type_traits/is_member_pointer.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_member_pointer.h'}}
+#include <__type_traits/is_move_assignable.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_move_assignable.h'}}
+#include <__type_traits/is_move_constructible.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_move_constructible.h'}}
+#include <__type_traits/is_nothrow_assignable.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_nothrow_assignable.h'}}
+#include <__type_traits/is_nothrow_constructible.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_nothrow_constructible.h'}}
+#include <__type_traits/is_nothrow_convertible.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_nothrow_convertible.h'}}
+#include <__type_traits/is_nothrow_copy_assignable.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_nothrow_copy_assignable.h'}}
+#include <__type_traits/is_nothrow_copy_constructible.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_nothrow_copy_constructible.h'}}
+#include <__type_traits/is_nothrow_default_constructible.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_nothrow_default_constructible.h'}}
+#include <__type_traits/is_nothrow_destructible.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_nothrow_destructible.h'}}
+#include <__type_traits/is_nothrow_move_assignable.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_nothrow_move_assignable.h'}}
+#include <__type_traits/is_nothrow_move_constructible.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_nothrow_move_constructible.h'}}
+#include <__type_traits/is_null_pointer.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_null_pointer.h'}}
+#include <__type_traits/is_object.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_object.h'}}
+#include <__type_traits/is_pod.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_pod.h'}}
+#include <__type_traits/is_pointer.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_pointer.h'}}
+#include <__type_traits/is_polymorphic.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_polymorphic.h'}}
+#include <__type_traits/is_primary_template.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_primary_template.h'}}
+#include <__type_traits/is_reference.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_reference.h'}}
+#include <__type_traits/is_reference_wrapper.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_reference_wrapper.h'}}
+#include <__type_traits/is_referenceable.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_referenceable.h'}}
+#include <__type_traits/is_same.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_same.h'}}
+#include <__type_traits/is_scalar.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_scalar.h'}}
+#include <__type_traits/is_scoped_enum.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_scoped_enum.h'}}
+#include <__type_traits/is_signed.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_signed.h'}}
+#include <__type_traits/is_signed_integer.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_signed_integer.h'}}
+#include <__type_traits/is_specialization.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_specialization.h'}}
+#include <__type_traits/is_standard_layout.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_standard_layout.h'}}
+#include <__type_traits/is_swappable.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_swappable.h'}}
+#include <__type_traits/is_trivial.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_trivial.h'}}
+#include <__type_traits/is_trivially_assignable.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_trivially_assignable.h'}}
+#include <__type_traits/is_trivially_constructible.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_trivially_constructible.h'}}
+#include <__type_traits/is_trivially_copy_assignable.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_trivially_copy_assignable.h'}}
+#include <__type_traits/is_trivially_copy_constructible.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_trivially_copy_constructible.h'}}
+#include <__type_traits/is_trivially_copyable.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_trivially_copyable.h'}}
+#include <__type_traits/is_trivially_default_constructible.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_trivially_default_constructible.h'}}
+#include <__type_traits/is_trivially_destructible.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_trivially_destructible.h'}}
+#include <__type_traits/is_trivially_move_assignable.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_trivially_move_assignable.h'}}
+#include <__type_traits/is_trivially_move_constructible.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_trivially_move_constructible.h'}}
+#include <__type_traits/is_unbounded_array.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_unbounded_array.h'}}
+#include <__type_traits/is_union.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_union.h'}}
+#include <__type_traits/is_unsigned.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_unsigned.h'}}
+#include <__type_traits/is_unsigned_integer.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_unsigned_integer.h'}}
+#include <__type_traits/is_valid_expansion.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_valid_expansion.h'}}
+#include <__type_traits/is_void.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_void.h'}}
+#include <__type_traits/is_volatile.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/is_volatile.h'}}
+#include <__type_traits/lazy.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/lazy.h'}}
+#include <__type_traits/make_32_64_or_128_bit.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/make_32_64_or_128_bit.h'}}
+#include <__type_traits/make_const_lvalue_ref.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/make_const_lvalue_ref.h'}}
+#include <__type_traits/make_signed.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/make_signed.h'}}
+#include <__type_traits/make_unsigned.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/make_unsigned.h'}}
+#include <__type_traits/maybe_const.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/maybe_const.h'}}
+#include <__type_traits/nat.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/nat.h'}}
+#include <__type_traits/negation.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/negation.h'}}
+#include <__type_traits/noexcept_move_assign_container.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/noexcept_move_assign_container.h'}}
+#include <__type_traits/promote.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/promote.h'}}
+#include <__type_traits/rank.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/rank.h'}}
+#include <__type_traits/remove_all_extents.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_all_extents.h'}}
+#include <__type_traits/remove_const.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_const.h'}}
+#include <__type_traits/remove_const_ref.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_const_ref.h'}}
+#include <__type_traits/remove_cv.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_cv.h'}}
+#include <__type_traits/remove_cvref.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_cvref.h'}}
+#include <__type_traits/remove_extent.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_extent.h'}}
+#include <__type_traits/remove_pointer.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_pointer.h'}}
+#include <__type_traits/remove_reference.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_reference.h'}}
+#include <__type_traits/remove_volatile.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/remove_volatile.h'}}
+#include <__type_traits/result_of.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/result_of.h'}}
+#include <__type_traits/strip_signature.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/strip_signature.h'}}
+#include <__type_traits/type_identity.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/type_identity.h'}}
+#include <__type_traits/type_list.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/type_list.h'}}
+#include <__type_traits/underlying_type.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/underlying_type.h'}}
+#include <__type_traits/void_t.h> // expected-error@*:* {{use of private header from outside its module: '__type_traits/void_t.h'}}
+#include <__utility/as_const.h> // expected-error@*:* {{use of private header from outside its module: '__utility/as_const.h'}}
+#include <__utility/auto_cast.h> // expected-error@*:* {{use of private header from outside its module: '__utility/auto_cast.h'}}
+#include <__utility/cmp.h> // expected-error@*:* {{use of private header from outside its module: '__utility/cmp.h'}}
+#include <__utility/convert_to_integral.h> // expected-error@*:* {{use of private header from outside its module: '__utility/convert_to_integral.h'}}
+#include <__utility/declval.h> // expected-error@*:* {{use of private header from outside its module: '__utility/declval.h'}}
+#include <__utility/exchange.h> // expected-error@*:* {{use of private header from outside its module: '__utility/exchange.h'}}
+#include <__utility/forward.h> // expected-error@*:* {{use of private header from outside its module: '__utility/forward.h'}}
+#include <__utility/forward_like.h> // expected-error@*:* {{use of private header from outside its module: '__utility/forward_like.h'}}
+#include <__utility/in_place.h> // expected-error@*:* {{use of private header from outside its module: '__utility/in_place.h'}}
+#include <__utility/integer_sequence.h> // expected-error@*:* {{use of private header from outside its module: '__utility/integer_sequence.h'}}
+#include <__utility/move.h> // expected-error@*:* {{use of private header from outside its module: '__utility/move.h'}}
+#include <__utility/pair.h> // expected-error@*:* {{use of private header from outside its module: '__utility/pair.h'}}
+#include <__utility/piecewise_construct.h> // expected-error@*:* {{use of private header from outside its module: '__utility/piecewise_construct.h'}}
+#include <__utility/priority_tag.h> // expected-error@*:* {{use of private header from outside its module: '__utility/priority_tag.h'}}
+#include <__utility/rel_ops.h> // expected-error@*:* {{use of private header from outside its module: '__utility/rel_ops.h'}}
+#include <__utility/small_buffer.h> // expected-error@*:* {{use of private header from outside its module: '__utility/small_buffer.h'}}
+#include <__utility/swap.h> // expected-error@*:* {{use of private header from outside its module: '__utility/swap.h'}}
+#include <__utility/to_underlying.h> // expected-error@*:* {{use of private header from outside its module: '__utility/to_underlying.h'}}
+#include <__utility/transaction.h> // expected-error@*:* {{use of private header from outside its module: '__utility/transaction.h'}}
+#include <__utility/unreachable.h> // expected-error@*:* {{use of private header from outside its module: '__utility/unreachable.h'}}
+#include <__variant/monostate.h> // expected-error@*:* {{use of private header from outside its module: '__variant/monostate.h'}}
+// GENERATED-MARKER
diff --git a/libcxx/test/libcxx/utilities/function.objects/func.wrap/func.wrap.move/assert.engaged.cpp b/libcxx/test/libcxx/utilities/function.objects/func.wrap/func.wrap.move/assert.engaged.cpp
new file mode 100644
index 00000000000000..910e83c625faab
--- /dev/null
+++ b/libcxx/test/libcxx/utilities/function.objects/func.wrap/func.wrap.move/assert.engaged.cpp
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: has-unix-headers
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_ASSERTIONS=1
+
+#include <functional>
+
+#include "check_assertion.h"
+
+int main(int, char**) {
+ std::move_only_function<void()> func;
+ TEST_LIBCPP_ASSERT_FAILURE(func(), "Tried to call a disengaged move_only_function");
+}
diff --git a/libcxx/test/libcxx/utilities/pointer_int_pair.pass.cpp b/libcxx/test/libcxx/utilities/pointer_int_pair.pass.cpp
new file mode 100644
index 00000000000000..92013752ddcc84
--- /dev/null
+++ b/libcxx/test/libcxx/utilities/pointer_int_pair.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+#include "test_macros.h"
+
+TEST_DIAGNOSTIC_PUSH
+TEST_CLANG_DIAGNOSTIC_IGNORED("-Wprivate-header")
+#include <__utility/pointer_int_pair.h>
+TEST_DIAGNOSTIC_POP
+
+#include <cassert>
+
+int main(int, char**) {
+ {
+ std::__pointer_int_pair<int*, 1> pair = nullptr;
+ assert(pair.__get_value() == 0);
+ assert(pair.__get_ptr() == nullptr);
+ }
+ {
+ std::__pointer_int_pair<int*, 1> pair(nullptr, 1);
+ assert(pair.__get_value() == 1);
+ assert(pair.__get_ptr() == nullptr);
+ }
+ {
+ static_assert(alignof(int) <= 4);
+ std::__pointer_int_pair<int*, 1> pair(reinterpret_cast<int*>(4), 0);
+ assert(pair.__get_value() == 0);
+ assert(pair.__get_ptr() == reinterpret_cast<int*>(4));
+ }
+}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/functional.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/functional.version.compile.pass.cpp
index 8ea19345903630..4768120991a7db 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/functional.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/functional.version.compile.pass.cpp
@@ -387,17 +387,11 @@
# error "__cpp_lib_invoke_r should have the value 202106L in c++23"
# endif
-# if !defined(_LIBCPP_VERSION)
-# ifndef __cpp_lib_move_only_function
-# error "__cpp_lib_move_only_function should be defined in c++23"
-# endif
-# if __cpp_lib_move_only_function != 202110L
-# error "__cpp_lib_move_only_function should have the value 202110L in c++23"
-# endif
-# else // _LIBCPP_VERSION
-# ifdef __cpp_lib_move_only_function
-# error "__cpp_lib_move_only_function should not be defined because it is unimplemented in libc++!"
-# endif
+# ifndef __cpp_lib_move_only_function
+# error "__cpp_lib_move_only_function should be defined in c++23"
+# endif
+# if __cpp_lib_move_only_function != 202110L
+# error "__cpp_lib_move_only_function should have the value 202110L in c++23"
# endif
# ifndef __cpp_lib_not_fn
@@ -509,17 +503,11 @@
# error "__cpp_lib_invoke_r should have the value 202106L in c++26"
# endif
-# if !defined(_LIBCPP_VERSION)
-# ifndef __cpp_lib_move_only_function
-# error "__cpp_lib_move_only_function should be defined in c++26"
-# endif
-# if __cpp_lib_move_only_function != 202110L
-# error "__cpp_lib_move_only_function should have the value 202110L in c++26"
-# endif
-# else // _LIBCPP_VERSION
-# ifdef __cpp_lib_move_only_function
-# error "__cpp_lib_move_only_function should not be defined because it is unimplemented in libc++!"
-# endif
+# ifndef __cpp_lib_move_only_function
+# error "__cpp_lib_move_only_function should be defined in c++26"
+# endif
+# if __cpp_lib_move_only_function != 202110L
+# error "__cpp_lib_move_only_function should have the value 202110L in c++26"
# endif
# ifndef __cpp_lib_not_fn
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
index 5deaee16895f66..12e1676d534b5c 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
@@ -5541,17 +5541,11 @@
# error "__cpp_lib_move_iterator_concept should have the value 202207L in c++23"
# endif
-# if !defined(_LIBCPP_VERSION)
-# ifndef __cpp_lib_move_only_function
-# error "__cpp_lib_move_only_function should be defined in c++23"
-# endif
-# if __cpp_lib_move_only_function != 202110L
-# error "__cpp_lib_move_only_function should have the value 202110L in c++23"
-# endif
-# else // _LIBCPP_VERSION
-# ifdef __cpp_lib_move_only_function
-# error "__cpp_lib_move_only_function should not be defined because it is unimplemented in libc++!"
-# endif
+# ifndef __cpp_lib_move_only_function
+# error "__cpp_lib_move_only_function should be defined in c++23"
+# endif
+# if __cpp_lib_move_only_function != 202110L
+# error "__cpp_lib_move_only_function should have the value 202110L in c++23"
# endif
# ifndef __cpp_lib_node_extract
@@ -7387,17 +7381,11 @@
# error "__cpp_lib_move_iterator_concept should have the value 202207L in c++26"
# endif
-# if !defined(_LIBCPP_VERSION)
-# ifndef __cpp_lib_move_only_function
-# error "__cpp_lib_move_only_function should be defined in c++26"
-# endif
-# if __cpp_lib_move_only_function != 202110L
-# error "__cpp_lib_move_only_function should have the value 202110L in c++26"
-# endif
-# else // _LIBCPP_VERSION
-# ifdef __cpp_lib_move_only_function
-# error "__cpp_lib_move_only_function should not be defined because it is unimplemented in libc++!"
-# endif
+# ifndef __cpp_lib_move_only_function
+# error "__cpp_lib_move_only_function should be defined in c++26"
+# endif
+# if __cpp_lib_move_only_function != 202110L
+# error "__cpp_lib_move_only_function should have the value 202110L in c++26"
# endif
# ifndef __cpp_lib_node_extract
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/assignment/functor.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/assignment/functor.pass.cpp
new file mode 100644
index 00000000000000..0598da573313b2
--- /dev/null
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/assignment/functor.pass.cpp
@@ -0,0 +1,84 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+#include <cassert>
+#include <concepts>
+#include <functional>
+#include <type_traits>
+#include <utility>
+
+#include "type_algorithms.h"
+#include "../common.h"
+
+template <class T>
+void test() {
+ static_assert(!std::is_nothrow_assignable_v<std::move_only_function<T>&, NonTrivial>);
+ {
+ std::move_only_function<T> f;
+ std::same_as<std::move_only_function<T>&> decltype(auto) ret = (f = &call_func);
+ assert(&ret == &f);
+ assert(f);
+ }
+ {
+ std::move_only_function<T> f;
+ decltype(&call_func) ptr = nullptr;
+ std::same_as<std::move_only_function<T>&> decltype(auto) ret = (f = ptr);
+ assert(&ret == &f);
+ assert(!f);
+ }
+ {
+ std::move_only_function<T> f;
+ std::same_as<std::move_only_function<T>&> decltype(auto) ret = (f = TriviallyDestructible{});
+ assert(&ret == &f);
+ assert(f);
+ }
+ {
+ std::move_only_function<T> f;
+ std::same_as<std::move_only_function<T>&> decltype(auto) ret = (f = TriviallyDestructibleTooLarge{});
+ assert(&ret == &f);
+ assert(f);
+ }
+ {
+ std::move_only_function<T> f;
+ std::same_as<std::move_only_function<T>&> decltype(auto) ret = (f = NonTrivial{});
+ assert(&ret == &f);
+ assert(f);
+ }
+}
+
+struct S {
+ void func() noexcept {}
+};
+
+template <class T>
+void test_member_function_pointer() {
+ {
+ std::move_only_function<T> f = &S::func;
+ std::move_only_function<T> f2;
+ f2 = std::move(f);
+ assert(f2);
+ }
+ {
+ decltype(&S::func) ptr = nullptr;
+ std::move_only_function<T> f = ptr;
+ std::move_only_function<T> f2;
+ f2 = std::move(f);
+ assert(!f2);
+ }
+}
+
+int main(int, char**) {
+ types::for_each(types::function_noexcept_const_ref_qualified<void()>{}, []<class T> { test<T>(); });
+ types::for_each(types::function_noexcept_const_ref_qualified<void(S)>{}, []<class T> {
+ test_member_function_pointer<T>();
+ });
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/assignment/move.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/assignment/move.pass.cpp
new file mode 100644
index 00000000000000..1f17d991e8c4fb
--- /dev/null
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/assignment/move.pass.cpp
@@ -0,0 +1,91 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+#include <cassert>
+#include <functional>
+#include <type_traits>
+#include <utility>
+
+#include "test_macros.h"
+#include "type_algorithms.h"
+#include "../common.h"
+
+template <class T>
+void test() {
+ static_assert(!std::is_assignable_v<std::move_only_function<T>, int>);
+ {
+ std::move_only_function<T> f = &call_func;
+ std::move_only_function<T> f2;
+ f2 = std::move(f);
+ assert(f2);
+ LIBCPP_ASSERT(!f);
+ }
+ {
+ decltype(&call_func) ptr = nullptr;
+ std::move_only_function<T> f = ptr;
+ std::move_only_function<T> f2;
+ f2 = std::move(f);
+ assert(!f2);
+ LIBCPP_ASSERT(!f);
+ }
+ {
+ std::move_only_function<T> f = TriviallyDestructible{};
+ std::move_only_function<T> f2;
+ f2 = std::move(f);
+ assert(f2);
+ LIBCPP_ASSERT(!f);
+ }
+ {
+ std::move_only_function<T> f = TriviallyDestructibleTooLarge{};
+ std::move_only_function<T> f2;
+ f2 = std::move(f);
+ assert(f2);
+ LIBCPP_ASSERT(!f);
+ }
+ {
+ std::move_only_function<T> f = NonTrivial{};
+ std::move_only_function<T> f2;
+ f2 = std::move(f);
+ assert(f2);
+ LIBCPP_ASSERT(!f);
+ }
+}
+
+struct S {
+ void func() noexcept {}
+};
+
+template <class T>
+void test_member_function_pointer() {
+ {
+ std::move_only_function<T> f = &S::func;
+ std::move_only_function<T> f2;
+ f2 = std::move(f);
+ assert(f2);
+ LIBCPP_ASSERT(!f);
+ }
+ {
+ decltype(&S::func) ptr = nullptr;
+ std::move_only_function<T> f = ptr;
+ std::move_only_function<T> f2;
+ f2 = std::move(f);
+ assert(!f2);
+ LIBCPP_ASSERT(!f);
+ }
+}
+
+int main(int, char**) {
+ types::for_each(types::function_noexcept_const_ref_qualified<void()>{}, []<class T> { test<T>(); });
+ types::for_each(types::function_noexcept_const_ref_qualified<void(S)>{}, []<class T> {
+ test_member_function_pointer<T>();
+ });
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/assignment/move_other.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/assignment/move_other.pass.cpp
new file mode 100644
index 00000000000000..b15e9337a1aaa1
--- /dev/null
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/assignment/move_other.pass.cpp
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+#include <cassert>
+#include <concepts>
+#include <functional>
+#include <utility>
+
+#include "type_algorithms.h"
+#include "../common.h"
+
+template <class T>
+void test() {
+ {
+ std::move_only_function<void() const noexcept> f1;
+ std::move_only_function<T> f2;
+ std::same_as<std::move_only_function<T>&> decltype(auto) ret = (f2 = std::move(f1));
+ assert(&ret == &f2);
+ assert(!f2);
+ }
+ {
+ std::move_only_function<void() const & noexcept> f1;
+ std::move_only_function<T> f2;
+ std::same_as<std::move_only_function<T>&> decltype(auto) ret = (f2 = std::move(f1));
+ assert(&ret == &f2);
+ assert(!f2);
+ }
+}
+
+template <class T>
+void test2() {
+ {
+ std::move_only_function<int() const noexcept> f1 = [] noexcept { return 109; };
+ std::move_only_function<T> f2;
+ std::same_as<std::move_only_function<T>&> decltype(auto) ret = (f2 = std::move(f1));
+ assert(&ret == &f2);
+ assert(f2);
+ assert(f2() == 109);
+ }
+ {
+ std::move_only_function<int() const& noexcept> f1 = [] noexcept { return 109; };
+ std::move_only_function<T> f2;
+ std::same_as<std::move_only_function<T>&> decltype(auto) ret = (f2 = std::move(f1));
+ assert(&ret == &f2);
+ assert(f2);
+ assert(f2() == 109);
+ }
+}
+
+int main(int, char**) {
+ types::for_each(types::function_noexcept_const_ref_qualified<void()>{}, []<class T> { test<T>(); });
+ types::for_each(types::function_noexcept_const_lvalue_ref_qualified<int()>{}, []<class T> { test2<T>(); });
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/assignment/nullptr.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/assignment/nullptr.pass.cpp
new file mode 100644
index 00000000000000..e32ace99f17f89
--- /dev/null
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/assignment/nullptr.pass.cpp
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+#include <cassert>
+#include <functional>
+
+#include "type_algorithms.h"
+#include "../common.h"
+
+template <class T>
+void test() {
+ {
+ std::move_only_function<T> f = &call_func;
+ f = nullptr;
+ assert(!f);
+ }
+ {
+ decltype(&call_func) ptr = nullptr;
+ std::move_only_function<T> f = ptr;
+ f = nullptr;
+ assert(!f);
+ }
+ {
+ std::move_only_function<T> f = TriviallyDestructible{};
+ f = nullptr;
+ assert(!f);
+ }
+ {
+ std::move_only_function<T> f = TriviallyDestructibleTooLarge{};
+ f = nullptr;
+ assert(!f);
+ }
+ {
+ std::move_only_function<T> f = NonTrivial{};
+ f = nullptr;
+ assert(!f);
+ }
+}
+
+struct S {
+ void func() noexcept {}
+};
+
+template <class T>
+void test_member_function_pointer() {
+ {
+ std::move_only_function<T> f = &S::func;
+ f = nullptr;
+ assert(!f);
+ }
+ {
+ decltype(&S::func) ptr = nullptr;
+ std::move_only_function<T> f = ptr;
+ f = nullptr;
+ assert(!f);
+ }
+}
+
+int main(int, char**) {
+ types::for_each(types::function_noexcept_const_ref_qualified<void()>{}, []<class T> { test<T>(); });
+ types::for_each(types::function_noexcept_const_ref_qualified<void(S)>{}, []<class T> {
+ test_member_function_pointer<T>();
+ });
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/lvalue.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/lvalue.pass.cpp
new file mode 100644
index 00000000000000..0f50f827c4d2a2
--- /dev/null
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/lvalue.pass.cpp
@@ -0,0 +1,102 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+#include <cassert>
+#include <functional>
+
+#include "test_macros.h"
+#include "../common.h"
+
+struct S {
+ void func() & {}
+};
+
+static_assert(std::is_invocable_v<std::move_only_function<void() &>&>);
+static_assert(!std::is_invocable_v<std::move_only_function<void() &>>);
+static_assert(!std::is_invocable_v<std::move_only_function<void() &>&&>);
+static_assert(!std::is_invocable_v<std::move_only_function<void() &> const&>);
+static_assert(!std::is_invocable_v<std::move_only_function<void() &> const >);
+static_assert(!std::is_invocable_v<std::move_only_function<void() &> const&&>);
+
+void test() {
+ {
+ called = false;
+ std::move_only_function<void()&> f = &call_func;
+ f();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void()&> f = TriviallyDestructible{};
+ f();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void()&> f = TriviallyDestructibleTooLarge{};
+ f();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void()&> f = NonTrivial{};
+ f();
+ assert(called);
+ }
+ {
+ std::move_only_function<void(S&)> f = &S::func;
+ assert(f);
+ }
+ {
+ decltype(&S::func) ptr = nullptr;
+ std::move_only_function<void(S&)> f = ptr;
+ assert(!f);
+ }
+ {
+ CallType type;
+ std::move_only_function<void()&> f = CallTypeChecker{&type};
+ f();
+ assert(type == CallType::LValue);
+ }
+}
+
+void test_return() {
+ {
+ called = false;
+ std::move_only_function<int(int)&> f = &get_val;
+ assert(f(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int)&> f = TriviallyDestructible{};
+ assert(f(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int)&> f = TriviallyDestructibleTooLarge{};
+ assert(f(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int)&> f = NonTrivial{};
+ assert(f(3) == 3);
+ assert(!called);
+ }
+}
+
+int main(int, char**) {
+ test();
+ test_return();
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/lvalue_const.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/lvalue_const.pass.cpp
new file mode 100644
index 00000000000000..82e2971fce287e
--- /dev/null
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/lvalue_const.pass.cpp
@@ -0,0 +1,118 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+#include <cassert>
+#include <functional>
+#include <utility>
+
+#include "test_macros.h"
+#include "../common.h"
+
+struct S {
+ void func() const& {}
+};
+
+static_assert(std::is_invocable_v<std::move_only_function<void() const&>&>);
+static_assert(std::is_invocable_v<std::move_only_function<void() const&>>);
+static_assert(std::is_invocable_v<std::move_only_function<void() const&>&&>);
+static_assert(std::is_invocable_v<std::move_only_function<void() const&> const&>);
+static_assert(std::is_invocable_v<std::move_only_function<void() const&> const >);
+static_assert(std::is_invocable_v<std::move_only_function<void() const&> const&&>);
+
+void test() {
+ {
+ called = false;
+ std::move_only_function<void() const&> f = &call_func;
+ f();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void() const&> f = TriviallyDestructible{};
+ f();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void() const&> f = TriviallyDestructibleTooLarge{};
+ f();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void() const&> f = NonTrivial{};
+ f();
+ assert(called);
+ }
+ {
+ std::move_only_function<void(const S&)> f = &S::func;
+ assert(f);
+ }
+ {
+ decltype(&S::func) ptr = nullptr;
+ std::move_only_function<void(const S&)> f = ptr;
+ assert(!f);
+ }
+ {
+ CallType type;
+ std::move_only_function<void() const&> f = CallTypeChecker{&type};
+ f();
+ assert(type == CallType::ConstLValue);
+ }
+ {
+ CallType type;
+ std::move_only_function<void() const&> f = CallTypeChecker{&type};
+ f();
+ assert(type == CallType::ConstLValue);
+ type = CallType::None;
+ std::as_const(f)();
+ assert(type == CallType::ConstLValue);
+ type = CallType::None;
+ std::move(f)();
+ assert(type == CallType::ConstLValue);
+ type = CallType::None;
+ std::move(std::as_const(f))();
+ assert(type == CallType::ConstLValue);
+ }
+}
+
+void test_return() {
+ {
+ called = false;
+ std::move_only_function<int(int) const&> f = &get_val;
+ assert(f(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int) const&> f = TriviallyDestructible{};
+ assert(f(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int) const&> f = TriviallyDestructibleTooLarge{};
+ assert(f(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int) const&> f = NonTrivial{};
+ assert(f(3) == 3);
+ assert(!called);
+ }
+}
+
+int main(int, char**) {
+ test();
+ test_return();
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/lvalue_const_noexcept.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/lvalue_const_noexcept.pass.cpp
new file mode 100644
index 00000000000000..d8129f541fc4fe
--- /dev/null
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/lvalue_const_noexcept.pass.cpp
@@ -0,0 +1,113 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+#include <cassert>
+#include <functional>
+#include <type_traits>
+#include <utility>
+
+#include "test_macros.h"
+#include "../common.h"
+
+struct S {
+ void func() const& noexcept {}
+};
+
+static_assert(std::is_invocable_v<std::move_only_function<void() const & noexcept>&>);
+static_assert(std::is_invocable_v<std::move_only_function<void() const & noexcept>>);
+static_assert(std::is_invocable_v<std::move_only_function<void() const & noexcept>&&>);
+static_assert(std::is_invocable_v<std::move_only_function<void() const & noexcept> const&>);
+static_assert(std::is_invocable_v<std::move_only_function<void() const & noexcept> const >);
+static_assert(std::is_invocable_v<std::move_only_function<void() const & noexcept> const&&>);
+
+void test() {
+ {
+ called = false;
+ std::move_only_function<void() const& noexcept> f = &call_func;
+ f();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void() const& noexcept> f = TriviallyDestructible{};
+ f();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void() const& noexcept> f = TriviallyDestructibleTooLarge{};
+ f();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void() const& noexcept> f = NonTrivial{};
+ f();
+ assert(called);
+ }
+ {
+ std::move_only_function<void(const S&) noexcept> f = &S::func;
+ assert(f);
+ }
+ {
+ decltype(&S::func) ptr = nullptr;
+ std::move_only_function<void(const S&) noexcept> f = ptr;
+ assert(!f);
+ }
+ {
+ CallType type;
+ std::move_only_function<void() const& noexcept> f = CallTypeCheckerNoexcept{&type};
+ f();
+ assert(type == CallType::ConstLValue);
+ type = CallType::None;
+ std::as_const(f)();
+ assert(type == CallType::ConstLValue);
+ type = CallType::None;
+ std::move(f)();
+ assert(type == CallType::ConstLValue);
+ type = CallType::None;
+ std::move(std::as_const(f))();
+ assert(type == CallType::ConstLValue);
+ }
+}
+
+void test_return() {
+ {
+ called = false;
+ std::move_only_function<int(int) const& noexcept> f = &get_val;
+ assert(f(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int) const& noexcept> f = TriviallyDestructible{};
+ assert(f(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int) const& noexcept> f = TriviallyDestructibleTooLarge{};
+ assert(f(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int) const& noexcept> f = NonTrivial{};
+ assert(f(3) == 3);
+ assert(!called);
+ }
+}
+
+int main(int, char**) {
+ test();
+ test_return();
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/lvalue_noexcept.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/lvalue_noexcept.pass.cpp
new file mode 100644
index 00000000000000..d14f527f812e1d
--- /dev/null
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/lvalue_noexcept.pass.cpp
@@ -0,0 +1,102 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+#include <cassert>
+#include <functional>
+
+#include "test_macros.h"
+#include "../common.h"
+
+struct S {
+ void func() & noexcept {}
+};
+
+static_assert(std::is_invocable_v<std::move_only_function<void() & noexcept>&>);
+static_assert(!std::is_invocable_v<std::move_only_function<void() & noexcept>>);
+static_assert(!std::is_invocable_v<std::move_only_function<void() & noexcept>&&>);
+static_assert(!std::is_invocable_v<std::move_only_function<void() & noexcept> const&>);
+static_assert(!std::is_invocable_v<std::move_only_function<void() & noexcept> const >);
+static_assert(!std::is_invocable_v<std::move_only_function<void() & noexcept> const&&>);
+
+void test() {
+ {
+ called = false;
+ std::move_only_function<void()& noexcept> f = &call_func;
+ f();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void()& noexcept> f = TriviallyDestructible{};
+ f();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void()& noexcept> f = TriviallyDestructibleTooLarge{};
+ f();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void()& noexcept> f = NonTrivial{};
+ f();
+ assert(called);
+ }
+ {
+ std::move_only_function<void(S&) noexcept> f = &S::func;
+ assert(f);
+ }
+ {
+ decltype(&S::func) ptr = nullptr;
+ std::move_only_function<void(S&) noexcept> f = ptr;
+ assert(!f);
+ }
+ {
+ CallType type;
+ std::move_only_function<void()& noexcept> f = CallTypeCheckerNoexcept{&type};
+ f();
+ assert(type == CallType::LValue);
+ }
+}
+
+void test_return() {
+ {
+ called = false;
+ std::move_only_function<int(int)& noexcept> f = &get_val;
+ assert(f(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int)& noexcept> f = TriviallyDestructible{};
+ assert(f(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int)& noexcept> f = TriviallyDestructibleTooLarge{};
+ assert(f(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int)& noexcept> f = NonTrivial{};
+ assert(f(3) == 3);
+ assert(!called);
+ }
+}
+
+int main(int, char**) {
+ test();
+ test_return();
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/normal.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/normal.pass.cpp
new file mode 100644
index 00000000000000..a1fe412efaa7f2
--- /dev/null
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/normal.pass.cpp
@@ -0,0 +1,106 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+#include <cassert>
+#include <functional>
+#include <utility>
+
+#include "test_macros.h"
+#include "../common.h"
+
+struct S {
+ void func() {}
+};
+
+static_assert(std::is_invocable_v<std::move_only_function<void()>&>);
+static_assert(std::is_invocable_v<std::move_only_function<void()>>);
+static_assert(std::is_invocable_v<std::move_only_function<void()>&&>);
+static_assert(!std::is_invocable_v<std::move_only_function<void()> const&>);
+static_assert(!std::is_invocable_v<std::move_only_function<void()> const >);
+static_assert(!std::is_invocable_v<std::move_only_function<void()> const&&>);
+
+void test() {
+ {
+ called = false;
+ std::move_only_function<void()> f = &call_func;
+ f();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void()> f = TriviallyDestructible{};
+ f();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void()> f = TriviallyDestructibleTooLarge{};
+ f();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void()> f = NonTrivial{};
+ f();
+ assert(called);
+ }
+ {
+ std::move_only_function<void(S)> f = &S::func;
+ assert(f);
+ }
+ {
+ decltype(&S::func) ptr = nullptr;
+ std::move_only_function<void(S)> f = ptr;
+ assert(!f);
+ }
+ {
+ CallType type;
+ std::move_only_function<void()> f = CallTypeChecker{&type};
+ f();
+ assert(type == CallType::LValue);
+ type = CallType::None;
+ std::move(f)();
+ assert(type == CallType::LValue);
+ }
+}
+
+void test_return() {
+ {
+ called = false;
+ std::move_only_function<int(int)> f = &get_val;
+ assert(f(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int)> f = TriviallyDestructible{};
+ assert(f(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int)> f = TriviallyDestructibleTooLarge{};
+ assert(f(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int)> f = NonTrivial{};
+ assert(f(3) == 3);
+ assert(!called);
+ }
+}
+
+int main(int, char**) {
+ test();
+ test_return();
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/normal_const.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/normal_const.pass.cpp
new file mode 100644
index 00000000000000..8d7bc198b42adb
--- /dev/null
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/normal_const.pass.cpp
@@ -0,0 +1,112 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+#include <cassert>
+#include <functional>
+#include <utility>
+
+#include "test_macros.h"
+#include "../common.h"
+
+struct S {
+ void func() const noexcept {}
+};
+
+static_assert(std::is_invocable_v<std::move_only_function<void() const>&>);
+static_assert(std::is_invocable_v<std::move_only_function<void() const>>);
+static_assert(std::is_invocable_v<std::move_only_function<void() const>&&>);
+static_assert(std::is_invocable_v<std::move_only_function<void() const> const&>);
+static_assert(std::is_invocable_v<std::move_only_function<void() const> const >);
+static_assert(std::is_invocable_v<std::move_only_function<void() const> const&&>);
+
+void test() {
+ {
+ called = false;
+ std::move_only_function<void() const> f = &call_func;
+ f();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void() const> f = TriviallyDestructible{};
+ f();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void() const> f = TriviallyDestructibleTooLarge{};
+ f();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void() const> f = NonTrivial{};
+ f();
+ assert(called);
+ }
+ {
+ std::move_only_function<void(S) const> f = &S::func;
+ assert(f);
+ }
+ {
+ decltype(&S::func) ptr = nullptr;
+ std::move_only_function<void(S) const> f = ptr;
+ assert(!f);
+ }
+ {
+ CallType type;
+ std::move_only_function<void() const> f = CallTypeChecker{&type};
+ f();
+ assert(type == CallType::ConstLValue);
+ type = CallType::None;
+ std::as_const(f)();
+ assert(type == CallType::ConstLValue);
+ type = CallType::None;
+ std::move(f)();
+ assert(type == CallType::ConstLValue);
+ type = CallType::None;
+ std::move(std::as_const(f))();
+ assert(type == CallType::ConstLValue);
+ }
+}
+
+void test_return() {
+ {
+ called = false;
+ std::move_only_function<int(int) const> f = &get_val;
+ assert(f(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int) const> f = TriviallyDestructible{};
+ assert(f(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int) const> f = TriviallyDestructibleTooLarge{};
+ assert(f(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int) const> f = NonTrivial{};
+ assert(f(3) == 3);
+ assert(!called);
+ }
+}
+
+int main(int, char**) {
+ test();
+ test_return();
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/normal_const_noexcept.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/normal_const_noexcept.pass.cpp
new file mode 100644
index 00000000000000..1c0d18db15430d
--- /dev/null
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/normal_const_noexcept.pass.cpp
@@ -0,0 +1,112 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+#include <cassert>
+#include <functional>
+#include <utility>
+
+#include "test_macros.h"
+#include "../common.h"
+
+struct S {
+ void func() const noexcept {}
+};
+
+static_assert(std::is_invocable_v<std::move_only_function<void() const noexcept>&>);
+static_assert(std::is_invocable_v<std::move_only_function<void() const noexcept>>);
+static_assert(std::is_invocable_v<std::move_only_function<void() const noexcept>&&>);
+static_assert(std::is_invocable_v<std::move_only_function<void() const noexcept> const&>);
+static_assert(std::is_invocable_v<std::move_only_function<void() const noexcept> const >);
+static_assert(std::is_invocable_v<std::move_only_function<void() const noexcept> const&&>);
+
+void test() {
+ {
+ called = false;
+ std::move_only_function<void() const noexcept> f = &call_func;
+ f();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void() const noexcept> f = TriviallyDestructible{};
+ f();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void() const noexcept> f = TriviallyDestructibleTooLarge{};
+ f();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void() const noexcept> f = NonTrivial{};
+ f();
+ assert(called);
+ }
+ {
+ std::move_only_function<void(S) const noexcept> f = &S::func;
+ assert(f);
+ }
+ {
+ decltype(&S::func) ptr = nullptr;
+ std::move_only_function<void(S) const noexcept> f = ptr;
+ assert(!f);
+ }
+ {
+ CallType type;
+ std::move_only_function<void() const noexcept> f = CallTypeCheckerNoexcept{&type};
+ f();
+ assert(type == CallType::ConstLValue);
+ type = CallType::None;
+ std::as_const(f)();
+ assert(type == CallType::ConstLValue);
+ type = CallType::None;
+ std::move(f)();
+ assert(type == CallType::ConstLValue);
+ type = CallType::None;
+ std::move(std::as_const(f))();
+ assert(type == CallType::ConstLValue);
+ }
+}
+
+void test_return() {
+ {
+ called = false;
+ std::move_only_function<int(int) const noexcept> f = &get_val;
+ assert(f(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int) const noexcept> f = TriviallyDestructible{};
+ assert(f(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int) const noexcept> f = TriviallyDestructibleTooLarge{};
+ assert(f(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int) const noexcept> f = NonTrivial{};
+ assert(f(3) == 3);
+ assert(!called);
+ }
+}
+
+int main(int, char**) {
+ test();
+ test_return();
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/normal_noexcept.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/normal_noexcept.pass.cpp
new file mode 100644
index 00000000000000..575bc27a35ab3a
--- /dev/null
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/normal_noexcept.pass.cpp
@@ -0,0 +1,106 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+#include <cassert>
+#include <functional>
+#include <utility>
+
+#include "test_macros.h"
+#include "../common.h"
+
+struct S {
+ void func() noexcept {}
+};
+
+static_assert(std::is_invocable_v<std::move_only_function<void() noexcept>&>);
+static_assert(std::is_invocable_v<std::move_only_function<void() noexcept>>);
+static_assert(std::is_invocable_v<std::move_only_function<void() noexcept>&&>);
+static_assert(!std::is_invocable_v<std::move_only_function<void() noexcept> const&>);
+static_assert(!std::is_invocable_v<std::move_only_function<void() noexcept> const >);
+static_assert(!std::is_invocable_v<std::move_only_function<void() noexcept> const&&>);
+
+void test() {
+ {
+ called = false;
+ std::move_only_function<void() noexcept> f = &call_func;
+ f();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void() noexcept> f = TriviallyDestructible{};
+ f();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void() noexcept> f = TriviallyDestructibleTooLarge{};
+ f();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void() noexcept> f = NonTrivial{};
+ f();
+ assert(called);
+ }
+ {
+ std::move_only_function<void(S) noexcept> f = &S::func;
+ assert(f);
+ }
+ {
+ decltype(&S::func) ptr = nullptr;
+ std::move_only_function<void(S) noexcept> f = ptr;
+ assert(!f);
+ }
+ {
+ CallType type;
+ std::move_only_function<void() noexcept> f = CallTypeCheckerNoexcept{&type};
+ f();
+ assert(type == CallType::LValue);
+ type = CallType::None;
+ std::move(f)();
+ assert(type == CallType::LValue);
+ }
+}
+
+void test_return() {
+ {
+ called = false;
+ std::move_only_function<int(int) noexcept> f = &get_val;
+ assert(f(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int) noexcept> f = TriviallyDestructible{};
+ assert(f(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int) noexcept> f = TriviallyDestructibleTooLarge{};
+ assert(f(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int) noexcept> f = NonTrivial{};
+ assert(f(3) == 3);
+ assert(!called);
+ }
+}
+
+int main(int, char**) {
+ test();
+ test_return();
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/rvalue.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/rvalue.pass.cpp
new file mode 100644
index 00000000000000..f51b48564dd338
--- /dev/null
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/rvalue.pass.cpp
@@ -0,0 +1,104 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+#include <cassert>
+#include <functional>
+#include <utility>
+
+#include "test_macros.h"
+#include "../common.h"
+
+struct S {
+ void func() && noexcept {}
+};
+
+static_assert(!std::is_invocable_v<std::move_only_function<void() &&>&>);
+static_assert(std::is_invocable_v<std::move_only_function<void() &&>>);
+static_assert(std::is_invocable_v<std::move_only_function<void() &&>&&>);
+static_assert(!std::is_invocable_v<std::move_only_function<void() &&> const&>);
+static_assert(!std::is_invocable_v<std::move_only_function<void() &&> const >);
+static_assert(!std::is_invocable_v<std::move_only_function<void() &&> const&&>);
+
+void test() {
+ {
+ called = false;
+ std::move_only_function<void()&&> f = &call_func;
+ std::move(f)();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void()&&> f = TriviallyDestructible{};
+ std::move(f)();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void()&&> f = TriviallyDestructibleTooLarge{};
+ std::move(f)();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void()&&> f = NonTrivial{};
+ std::move(f)();
+ assert(called);
+ }
+ {
+ std::move_only_function<void(S)&&> f = &S::func;
+ assert(f);
+ }
+ {
+ decltype(&S::func) ptr = nullptr;
+ std::move_only_function<void(S)&&> f = ptr;
+ assert(!f);
+ }
+ {
+ CallType type;
+ std::move_only_function<void()&&> f = CallTypeChecker{&type};
+ type = CallType::None;
+ std::move(f)();
+ assert(type == CallType::RValue);
+ }
+}
+
+void test_return() {
+ {
+ called = false;
+ std::move_only_function<int(int)&&> f = &get_val;
+ assert(std::move(f)(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int)&&> f = TriviallyDestructible{};
+ assert(std::move(f)(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int)&&> f = TriviallyDestructibleTooLarge{};
+ assert(std::move(f)(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int)&&> f = NonTrivial{};
+ assert(std::move(f)(3) == 3);
+ assert(!called);
+ }
+}
+
+int main(int, char**) {
+ test();
+ test_return();
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/rvalue_const.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/rvalue_const.pass.cpp
new file mode 100644
index 00000000000000..fc664525d171a5
--- /dev/null
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/rvalue_const.pass.cpp
@@ -0,0 +1,107 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+#include <cassert>
+#include <functional>
+#include <utility>
+
+#include "test_macros.h"
+#include "../common.h"
+
+struct S {
+ void func() const&& noexcept {}
+};
+
+static_assert(!std::is_invocable_v<std::move_only_function<void() const&&>&>);
+static_assert(std::is_invocable_v<std::move_only_function<void() const&&>>);
+static_assert(std::is_invocable_v<std::move_only_function<void() const&&>&&>);
+static_assert(!std::is_invocable_v<std::move_only_function<void() const&&> const&>);
+static_assert(std::is_invocable_v<std::move_only_function<void() const&&> const >);
+static_assert(std::is_invocable_v<std::move_only_function<void() const&&> const&&>);
+
+void test() {
+ {
+ called = false;
+ std::move_only_function<void() const&&> f = &call_func;
+ std::move(f)();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void() const&&> f = TriviallyDestructible{};
+ std::move(f)();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void() const&&> f = TriviallyDestructibleTooLarge{};
+ std::move(f)();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void() const&&> f = NonTrivial{};
+ std::move(f)();
+ assert(called);
+ }
+ {
+ std::move_only_function<void(S) const&&> f = &S::func;
+ assert(f);
+ }
+ {
+ decltype(&S::func) ptr = nullptr;
+ std::move_only_function<void(S) const&&> f = ptr;
+ assert(!f);
+ }
+ {
+ CallType type;
+ std::move_only_function<void() const&&> f = CallTypeChecker{&type};
+ type = CallType::None;
+ std::move(f)();
+ assert(type == CallType::ConstRValue);
+ type = CallType::None;
+ std::move(std::as_const(f))();
+ assert(type == CallType::ConstRValue);
+ }
+}
+
+void test_return() {
+ {
+ called = false;
+ std::move_only_function<int(int) const&&> f = &get_val;
+ assert(std::move(f)(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int) const&&> f = TriviallyDestructible{};
+ assert(std::move(f)(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int) const&&> f = TriviallyDestructibleTooLarge{};
+ assert(std::move(f)(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int) const&&> f = NonTrivial{};
+ assert(std::move(f)(3) == 3);
+ assert(!called);
+ }
+}
+
+int main(int, char**) {
+ test();
+ test_return();
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/rvalue_const_noexcept.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/rvalue_const_noexcept.pass.cpp
new file mode 100644
index 00000000000000..245b60eb454524
--- /dev/null
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/rvalue_const_noexcept.pass.cpp
@@ -0,0 +1,107 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+#include <cassert>
+#include <functional>
+#include <utility>
+
+#include "test_macros.h"
+#include "../common.h"
+
+struct S {
+ void func() const&& noexcept {}
+};
+
+static_assert(!std::is_invocable_v<std::move_only_function<void() const && noexcept>&>);
+static_assert(std::is_invocable_v<std::move_only_function<void() const && noexcept>>);
+static_assert(std::is_invocable_v<std::move_only_function<void() const && noexcept>&&>);
+static_assert(!std::is_invocable_v<std::move_only_function<void() const && noexcept> const&>);
+static_assert(std::is_invocable_v<std::move_only_function<void() const && noexcept> const >);
+static_assert(std::is_invocable_v<std::move_only_function<void() const && noexcept> const&&>);
+
+void test() {
+ {
+ called = false;
+ std::move_only_function<void() const&& noexcept> f = &call_func;
+ std::move(f)();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void() const&& noexcept> f = TriviallyDestructible{};
+ std::move(f)();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void() const&& noexcept> f = TriviallyDestructibleTooLarge{};
+ std::move(f)();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void() const&& noexcept> f = NonTrivial{};
+ std::move(f)();
+ assert(called);
+ }
+ {
+ std::move_only_function<void(S) const&& noexcept> f = &S::func;
+ assert(f);
+ }
+ {
+ decltype(&S::func) ptr = nullptr;
+ std::move_only_function<void(S) const&& noexcept> f = ptr;
+ assert(!f);
+ }
+ {
+ CallType type;
+ std::move_only_function<void() const&& noexcept> f = CallTypeCheckerNoexcept{&type};
+ type = CallType::None;
+ std::move(f)();
+ assert(type == CallType::ConstRValue);
+ type = CallType::None;
+ std::move(std::as_const(f))();
+ assert(type == CallType::ConstRValue);
+ }
+}
+
+void test_return() {
+ {
+ called = false;
+ std::move_only_function<int(int) const&& noexcept> f = &get_val;
+ assert(std::move(f)(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int) const&& noexcept> f = TriviallyDestructible{};
+ assert(std::move(f)(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int) const&& noexcept> f = TriviallyDestructibleTooLarge{};
+ assert(std::move(f)(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int) const&& noexcept> f = NonTrivial{};
+ assert(std::move(f)(3) == 3);
+ assert(!called);
+ }
+}
+
+int main(int, char**) {
+ test();
+ test_return();
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/rvalue_noexcept.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/rvalue_noexcept.pass.cpp
new file mode 100644
index 00000000000000..87201aeec85cb2
--- /dev/null
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/call/rvalue_noexcept.pass.cpp
@@ -0,0 +1,104 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+#include <cassert>
+#include <functional>
+#include <utility>
+
+#include "test_macros.h"
+#include "../common.h"
+
+struct S {
+ void func() && noexcept {}
+};
+
+static_assert(!std::is_invocable_v<std::move_only_function<void() && noexcept>&>);
+static_assert(std::is_invocable_v<std::move_only_function<void() && noexcept>>);
+static_assert(std::is_invocable_v<std::move_only_function<void() && noexcept>&&>);
+static_assert(!std::is_invocable_v<std::move_only_function<void() && noexcept> const&>);
+static_assert(!std::is_invocable_v<std::move_only_function<void() && noexcept> const >);
+static_assert(!std::is_invocable_v<std::move_only_function<void() && noexcept> const&&>);
+
+void test() {
+ {
+ called = false;
+ std::move_only_function<void()&& noexcept> f = &call_func;
+ std::move(f)();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void()&& noexcept> f = TriviallyDestructible{};
+ std::move(f)();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void()&& noexcept> f = TriviallyDestructibleTooLarge{};
+ std::move(f)();
+ assert(called);
+ }
+ {
+ called = false;
+ std::move_only_function<void()&& noexcept> f = NonTrivial{};
+ std::move(f)();
+ assert(called);
+ }
+ {
+ std::move_only_function<void(S)&& noexcept> f = &S::func;
+ assert(f);
+ }
+ {
+ decltype(&S::func) ptr = nullptr;
+ std::move_only_function<void(S)&& noexcept> f = ptr;
+ assert(!f);
+ }
+ {
+ CallType type;
+ std::move_only_function<void()&& noexcept> f = CallTypeCheckerNoexcept{&type};
+ type = CallType::None;
+ std::move(f)();
+ assert(type == CallType::RValue);
+ }
+}
+
+void test_return() {
+ {
+ called = false;
+ std::move_only_function<int(int)&& noexcept> f = &get_val;
+ assert(std::move(f)(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int)&& noexcept> f = TriviallyDestructible{};
+ assert(std::move(f)(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int)&& noexcept> f = TriviallyDestructibleTooLarge{};
+ assert(std::move(f)(3) == 3);
+ assert(!called);
+ }
+ {
+ called = false;
+ std::move_only_function<int(int)&& noexcept> f = NonTrivial{};
+ assert(std::move(f)(3) == 3);
+ assert(!called);
+ }
+}
+
+int main(int, char**) {
+ test();
+ test_return();
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/common.h b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/common.h
new file mode 100644
index 00000000000000..e0d82d9b004997
--- /dev/null
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/common.h
@@ -0,0 +1,80 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MOVE_ONLY_FUNCTION_COMMON_H
+#define MOVE_ONLY_FUNCTION_COMMON_H
+
+#include <initializer_list>
+#include <type_traits>
+
+inline bool called;
+inline void call_func() noexcept { called = true; }
+
+struct MoveCounter {
+ int* counter_;
+ MoveCounter(int* counter) : counter_(counter) {}
+ MoveCounter(MoveCounter&& other) : counter_(other.counter_) { ++*counter_; }
+};
+
+struct TriviallyDestructible {
+ TriviallyDestructible() = default;
+ TriviallyDestructible(MoveCounter) {}
+ TriviallyDestructible(std::initializer_list<int>, MoveCounter) {}
+ void operator()() const noexcept { called = true; }
+ int operator()(int i) const noexcept { return i; }
+};
+
+struct TriviallyDestructibleTooLarge {
+ TriviallyDestructibleTooLarge() = default;
+ TriviallyDestructibleTooLarge(MoveCounter) {}
+ TriviallyDestructibleTooLarge(std::initializer_list<int>, MoveCounter) {}
+ void operator()() const noexcept { called = true; }
+ int operator()(int i) const noexcept { return i; }
+ char a[5 * sizeof(void*)];
+};
+
+struct NonTrivial {
+ NonTrivial() = default;
+ NonTrivial(MoveCounter) {}
+ NonTrivial(std::initializer_list<int>&, MoveCounter) {}
+ NonTrivial(NonTrivial&&) noexcept(false) {}
+ ~NonTrivial() {}
+
+ void operator()() const noexcept { called = true; }
+ int operator()(int i) const noexcept { return i; }
+};
+
+inline int get_val(int i) noexcept { return i; }
+
+enum class CallType {
+ None,
+ LValue,
+ RValue,
+ ConstLValue,
+ ConstRValue,
+};
+
+struct CallTypeChecker {
+ CallType* type;
+ using enum CallType;
+ void operator()() & { *type = LValue; }
+ void operator()() && { *type = RValue; }
+ void operator()() const& { *type = ConstLValue; }
+ void operator()() const&& { *type = ConstRValue; }
+};
+
+struct CallTypeCheckerNoexcept {
+ CallType* type;
+ using enum CallType;
+ void operator()() & noexcept { *type = LValue; }
+ void operator()() && noexcept { *type = RValue; }
+ void operator()() const& noexcept { *type = ConstLValue; }
+ void operator()() const&& noexcept { *type = ConstRValue; }
+};
+
+#endif // MOVE_ONLY_FUNCTION_COMMON_H
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/default.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/default.pass.cpp
new file mode 100644
index 00000000000000..d2490628a4bfc8
--- /dev/null
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/default.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+#include <cassert>
+#include <functional>
+
+#include "type_algorithms.h"
+
+template <class T>
+void test() {
+ std::move_only_function<T> f;
+ assert(!f);
+}
+
+int main(int, char**) {
+ types::for_each(types::function_noexcept_const_ref_qualified<void()>{}, []<class T> { test<T>(); });
+ types::for_each(types::function_noexcept_const_ref_qualified<int()>{}, []<class T> { test<T>(); });
+ types::for_each(types::function_noexcept_const_ref_qualified<int(int)>{}, []<class T> { test<T>(); });
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/functor.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/functor.pass.cpp
new file mode 100644
index 00000000000000..ef38e80159af81
--- /dev/null
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/functor.pass.cpp
@@ -0,0 +1,115 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+#include <cassert>
+#include <functional>
+
+#include "count_new.h"
+#include "test_macros.h"
+#include "type_algorithms.h"
+#include "../common.h"
+
+template <class T>
+void test() {
+ {
+ std::move_only_function<T> f = &call_func;
+ assert(f);
+ }
+ {
+ decltype(&call_func) ptr = nullptr;
+ std::move_only_function<T> f = ptr;
+ assert(!f);
+ }
+ {
+ std::move_only_function<T> f = TriviallyDestructible{};
+ assert(f);
+ }
+ {
+ std::move_only_function<T> f = TriviallyDestructibleTooLarge{};
+ assert(f);
+ }
+ {
+ std::move_only_function<T> f = NonTrivial{};
+ assert(f);
+ }
+}
+
+struct S {
+ void func() noexcept {}
+};
+
+template <class T>
+void test_member_function_pointer() {
+ {
+ std::move_only_function<T> f = &S::func;
+ assert(f);
+ }
+ {
+ decltype(&S::func) ptr = nullptr;
+ std::move_only_function<T> f = ptr;
+ assert(!f);
+ }
+}
+
+template <class T>
+void test_value_return_type() {
+ {
+ std::move_only_function<T> f = &get_val;
+ assert(f);
+ }
+ {
+ decltype(&get_val) ptr = nullptr;
+ std::move_only_function<T> f = ptr;
+ assert(!f);
+ }
+ {
+ std::move_only_function<T> f = TriviallyDestructible{};
+ assert(f);
+ }
+ {
+ std::move_only_function<T> f = TriviallyDestructibleTooLarge{};
+ assert(f);
+ }
+ {
+ std::move_only_function<T> f = NonTrivial{};
+ assert(f);
+ }
+}
+
+template <class T>
+void test_throwing() {
+ struct ThrowingFunctor {
+ ThrowingFunctor() = default;
+ ThrowingFunctor(const ThrowingFunctor&) { throw 1; }
+ void operator()() {}
+ };
+ std::move_only_function<T> func({});
+}
+
+void check_new_delete_called() {
+ assert(globalMemCounter.new_called == globalMemCounter.delete_called);
+ assert(globalMemCounter.new_array_called == globalMemCounter.delete_array_called);
+ assert(globalMemCounter.aligned_new_called == globalMemCounter.aligned_delete_called);
+ assert(globalMemCounter.aligned_new_array_called == globalMemCounter.aligned_delete_array_called);
+}
+
+int main(int, char**) {
+ types::for_each(types::function_noexcept_const_ref_qualified<void()>{}, []<class T> { test<T>(); });
+ types::for_each(types::function_noexcept_const_ref_qualified<void(S)>{}, []<class T> {
+ test_member_function_pointer<T>();
+ });
+ types::for_each(types::function_noexcept_const_ref_qualified<int(int)>{}, []<class T> {
+ test_value_return_type<T>();
+ });
+ types::for_each(types::function_noexcept_const_ref_qualified<void()>{}, []<class T> { test_throwing<T>(); });
+ check_new_delete_called();
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/in_place.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/in_place.pass.cpp
new file mode 100644
index 00000000000000..9e415a97866331
--- /dev/null
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/in_place.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+#include <cassert>
+#include <functional>
+#include <utility>
+
+#include "test_macros.h"
+#include "type_algorithms.h"
+#include "../common.h"
+
+template <class T>
+void test() {
+ {
+ int counter = 0;
+ std::move_only_function<T> f{std::in_place_type<TriviallyDestructible>, MoveCounter{&counter}};
+ assert(f);
+ assert(counter == 1);
+ }
+ {
+ int counter = 0;
+ std::move_only_function<T> f{std::in_place_type<TriviallyDestructibleTooLarge>, MoveCounter{&counter}};
+ assert(f);
+ assert(counter == 1);
+ }
+ {
+ int counter = 0;
+ std::move_only_function<T> f{std::in_place_type<NonTrivial>, MoveCounter{&counter}};
+ assert(f);
+ assert(counter == 1);
+ }
+}
+
+int main(int, char**) {
+ types::for_each(types::function_noexcept_const_ref_qualified<void()>{}, []<class T> { test<T>(); });
+ types::for_each(types::function_noexcept_const_ref_qualified<int(int)>{}, []<class T> { test<T>(); });
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/in_place_init_list.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/in_place_init_list.pass.cpp
new file mode 100644
index 00000000000000..46c16e24f5ffda
--- /dev/null
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/in_place_init_list.pass.cpp
@@ -0,0 +1,46 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+#include <cassert>
+#include <functional>
+#include <utility>
+
+#include "test_macros.h"
+#include "type_algorithms.h"
+#include "../common.h"
+
+template <class T>
+void test() {
+ {
+ int counter = 0;
+ std::move_only_function<T> f{std::in_place_type<TriviallyDestructible>, {1}, MoveCounter{&counter}};
+ assert(f);
+ assert(counter == 1);
+ }
+ {
+ int counter = 0;
+ std::move_only_function<T> f{std::in_place_type<TriviallyDestructibleTooLarge>, {1}, MoveCounter{&counter}};
+ assert(f);
+ assert(counter == 1);
+ }
+ {
+ int counter = 0;
+ std::move_only_function<T> f{std::in_place_type<NonTrivial>, {1}, MoveCounter{&counter}};
+ assert(f);
+ assert(counter == 1);
+ }
+}
+
+int main(int, char**) {
+ types::for_each(types::function_noexcept_const_ref_qualified<void()>{}, []<class T> { test<T>(); });
+ types::for_each(types::function_noexcept_const_ref_qualified<int(int)>{}, []<class T> { test<T>(); });
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/move.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/move.pass.cpp
new file mode 100644
index 00000000000000..34688b252ab483
--- /dev/null
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/move.pass.cpp
@@ -0,0 +1,106 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+#include <cassert>
+#include <functional>
+#include <utility>
+
+#include "test_macros.h"
+#include "type_algorithms.h"
+#include "../common.h"
+
+template <class T>
+void test() {
+ {
+ std::move_only_function<T> f = &call_func;
+ std::move_only_function<T> f2 = std::move(f);
+ assert(f2);
+ }
+ {
+ decltype(&call_func) ptr = nullptr;
+ std::move_only_function<T> f = ptr;
+ std::move_only_function<T> f2 = std::move(f);
+ assert(!f2);
+ }
+ {
+ std::move_only_function<T> f = TriviallyDestructible{};
+ std::move_only_function<T> f2 = std::move(f);
+ assert(f2);
+ }
+ {
+ std::move_only_function<T> f = TriviallyDestructibleTooLarge{};
+ std::move_only_function<T> f2 = std::move(f);
+ assert(f2);
+ }
+ {
+ std::move_only_function<T> f = NonTrivial{};
+ std::move_only_function<T> f2 = std::move(f);
+ assert(f2);
+ }
+}
+
+struct S {
+ void func() noexcept {}
+};
+
+template <class T>
+void test_member_function_pointer() {
+ {
+ std::move_only_function<T> f = &S::func;
+ std::move_only_function<T> f2 = std::move(f);
+ assert(f2);
+ }
+ {
+ decltype(&S::func) ptr = nullptr;
+ std::move_only_function<T> f = ptr;
+ std::move_only_function<T> f2 = std::move(f);
+ assert(!f2);
+ }
+}
+
+template <class T>
+void test_value() {
+ {
+ std::move_only_function<T> f = &get_val;
+ std::move_only_function<T> f2 = std::move(f);
+ assert(f2);
+ }
+ {
+ decltype(&get_val) ptr = nullptr;
+ std::move_only_function<T> f = ptr;
+ std::move_only_function<T> f2 = std::move(f);
+ assert(!f2);
+ }
+ {
+ std::move_only_function<T> f = TriviallyDestructible{};
+ std::move_only_function<T> f2 = std::move(f);
+ assert(f2);
+ }
+ {
+ std::move_only_function<T> f = TriviallyDestructibleTooLarge{};
+ std::move_only_function<T> f2 = std::move(f);
+ assert(f2);
+ }
+ {
+ std::move_only_function<T> f = NonTrivial{};
+ std::move_only_function<T> f2 = std::move(f);
+ assert(f2);
+ }
+}
+
+int main(int, char**) {
+ types::for_each(types::function_noexcept_const_ref_qualified<void()>{}, []<class T> { test<T>(); });
+ types::for_each(types::function_noexcept_const_ref_qualified<void(S)>{}, []<class T> {
+ test_member_function_pointer<T>();
+ });
+ types::for_each(types::function_noexcept_const_ref_qualified<int(int)>{}, []<class T> { test_value<T>(); });
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/move_other.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/move_other.pass.cpp
new file mode 100644
index 00000000000000..805775579bd38b
--- /dev/null
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/move_other.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+#include <cassert>
+#include <functional>
+#include <utility>
+
+#include "type_algorithms.h"
+
+static_assert(!std::is_constructible_v<std::move_only_function<void() const>, std::move_only_function<void()>>);
+static_assert(!std::is_constructible_v<std::move_only_function<void() noexcept>, std::move_only_function<void()>>);
+static_assert(
+ !std::is_constructible_v<std::move_only_function<void() const noexcept>, std::move_only_function<void()>>);
+static_assert(
+ !std::is_constructible_v<std::move_only_function<void() const noexcept>, std::move_only_function<void() const>>);
+static_assert(
+ !std::is_constructible_v<std::move_only_function<void() const noexcept>, std::move_only_function<void() noexcept>>);
+
+template <class T>
+void test() {
+ {
+ std::move_only_function<void() const noexcept> f1;
+ std::move_only_function<T> f2 = std::move(f1);
+ assert(!f2);
+ }
+ {
+ std::move_only_function<void() const & noexcept> f1;
+ std::move_only_function<T> f2 = std::move(f1);
+ assert(!f2);
+ }
+}
+
+int main(int, char**) {
+ types::for_each(types::function_noexcept_const_ref_qualified<void()>{}, []<class T> { test<T>(); });
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/nullptr.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/nullptr.pass.cpp
new file mode 100644
index 00000000000000..1ab95f271b4bc7
--- /dev/null
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/ctors/nullptr.pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+#include <cassert>
+#include <functional>
+
+#include "type_algorithms.h"
+
+template <class T>
+void test() {
+ std::move_only_function<T> f = nullptr;
+ assert(!f);
+}
+
+int main(int, char**) {
+ types::for_each(types::function_noexcept_const_ref_qualified<void()>{}, []<class T> { test<T>(); });
+ types::for_each(types::function_noexcept_const_ref_qualified<int()>{}, []<class T> { test<T>(); });
+ types::for_each(types::function_noexcept_const_ref_qualified<int(int)>{}, []<class T> { test<T>(); });
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/swap.adl.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/swap.adl.pass.cpp
new file mode 100644
index 00000000000000..d9200dfd3a1dcd
--- /dev/null
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/swap.adl.pass.cpp
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+#include <cassert>
+#include <functional>
+
+#include "type_algorithms.h"
+#include "common.h"
+
+template <class T>
+void test() {
+ {
+ std::move_only_function<T> f = &call_func;
+ std::move_only_function<T> f2;
+ swap(f, f2);
+ }
+ {
+ decltype(&call_func) ptr = nullptr;
+ std::move_only_function<T> f = ptr;
+ std::move_only_function<T> f2;
+ swap(f, f2);
+ }
+ {
+ std::move_only_function<T> f = TriviallyDestructible{};
+ std::move_only_function<T> f2;
+ swap(f, f2);
+ }
+ {
+ std::move_only_function<T> f = TriviallyDestructibleTooLarge{};
+ std::move_only_function<T> f2;
+ swap(f, f2);
+ }
+ {
+ std::move_only_function<T> f = NonTrivial{};
+ std::move_only_function<T> f2;
+ swap(f, f2);
+ }
+}
+
+struct S {
+ void func() noexcept {}
+};
+
+template <class T>
+void test_member_function_pointer() {
+ {
+ std::move_only_function<T> f = &S::func;
+ std::move_only_function<T> f2;
+ swap(f, f2);
+ }
+ {
+ decltype(&S::func) ptr = nullptr;
+ std::move_only_function<T> f = ptr;
+ std::move_only_function<T> f2;
+ swap(f, f2);
+ }
+}
+
+int main(int, char**) {
+ types::for_each(types::function_noexcept_const_ref_qualified<void()>{}, []<class T> { test<T>(); });
+ types::for_each(types::function_noexcept_const_ref_qualified<void(S)>{}, []<class T> {
+ test_member_function_pointer<T>();
+ });
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/swap.member.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/swap.member.pass.cpp
new file mode 100644
index 00000000000000..b14769dcc1223b
--- /dev/null
+++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.move/swap.member.pass.cpp
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+#include <cassert>
+#include <functional>
+
+#include "type_algorithms.h"
+#include "common.h"
+
+template <class T>
+void test() {
+ {
+ std::move_only_function<T> f = &call_func;
+ std::move_only_function<T> f2;
+ f.swap(f2);
+ }
+ {
+ decltype(&call_func) ptr = nullptr;
+ std::move_only_function<T> f = ptr;
+ std::move_only_function<T> f2;
+ f.swap(f2);
+ }
+ {
+ std::move_only_function<T> f = TriviallyDestructible{};
+ std::move_only_function<T> f2;
+ f.swap(f2);
+ }
+ {
+ std::move_only_function<T> f = TriviallyDestructibleTooLarge{};
+ std::move_only_function<T> f2;
+ f.swap(f2);
+ }
+ {
+ std::move_only_function<T> f = NonTrivial{};
+ std::move_only_function<T> f2;
+ f.swap(f2);
+ }
+}
+
+struct S {
+ void func() noexcept {}
+};
+
+template <class T>
+void test_member_function_pointer() {
+ {
+ std::move_only_function<T> f = &S::func;
+ std::move_only_function<T> f2;
+ f.swap(f2);
+ }
+ {
+ decltype(&S::func) ptr = nullptr;
+ std::move_only_function<T> f = ptr;
+ std::move_only_function<T> f2;
+ f.swap(f2);
+ }
+}
+
+int main(int, char**) {
+ types::for_each(types::function_noexcept_const_ref_qualified<void()>{}, []<class T> { test<T>(); });
+ types::for_each(types::function_noexcept_const_ref_qualified<void(S)>{}, []<class T> {
+ test_member_function_pointer<T>();
+ });
+
+ return 0;
+}
diff --git a/libcxx/test/support/type_algorithms.h b/libcxx/test/support/type_algorithms.h
index da3d0add4d0c45..b6f65ebb8d7160 100644
--- a/libcxx/test/support/type_algorithms.h
+++ b/libcxx/test/support/type_algorithms.h
@@ -144,6 +144,42 @@ struct type_list_as_pointers<type_list<Types...> > {
template <class T>
using as_pointers = typename type_list_as_pointers<T>::type;
+template <class...>
+struct function_noexcept_const_lvalue_ref_qualified_impl;
+
+template <class ReturnT, class... Args>
+struct function_noexcept_const_lvalue_ref_qualified_impl<ReturnT(Args...)> {
+ using type =
+ type_list<ReturnT(Args...),
+ ReturnT(Args...)&,
+ ReturnT(Args...) noexcept,
+ ReturnT(Args...) & noexcept,
+ ReturnT(Args...) const,
+ ReturnT(Args...) const&,
+ ReturnT(Args...) const noexcept,
+ ReturnT(Args...) const & noexcept>;
+};
+
+template <class Func>
+using function_noexcept_const_lvalue_ref_qualified =
+ typename function_noexcept_const_lvalue_ref_qualified_impl<Func>::type;
+
+template <class...>
+struct function_noexcept_const_ref_qualified_impl;
+
+template <class ReturnT, class... Args>
+struct function_noexcept_const_ref_qualified_impl<ReturnT(Args...)> {
+ using type =
+ concatenate_t<function_noexcept_const_lvalue_ref_qualified<ReturnT(Args...)>,
+ type_list<ReturnT(Args...)&&,
+ ReturnT(Args...) && noexcept,
+ ReturnT(Args...) const&&,
+ ReturnT(Args...) const && noexcept> >;
+};
+
+template <class Func>
+using function_noexcept_const_ref_qualified = typename function_noexcept_const_ref_qualified_impl<Func>::type;
+
} // namespace types
#endif // TEST_SUPPORT_TYPE_ALGORITHMS_H
diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py
index 197d6bbc692226..82e62b46542d26 100755
--- a/libcxx/utils/generate_feature_test_macro_components.py
+++ b/libcxx/utils/generate_feature_test_macro_components.py
@@ -902,7 +902,6 @@ def add_version_header(tc):
"name": "__cpp_lib_move_only_function",
"values": {"c++23": 202110},
"headers": ["functional"],
- "unimplemented": True,
},
{
"name": "__cpp_lib_node_extract",
More information about the llvm-branch-commits
mailing list