[libcxx-commits] [libcxx] [libcxx] improves diagnostics for containers with bad value types (PR #106296)
via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Aug 27 14:41:53 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff e19c3a7e8d0df4d9a4f8e8bb4b563a1916d21a9f 59e11c6753d359fefc5bce9546f10f1f4e94d98d --extensions ,cpp,h -- libcxx/test/libcxx/containers/associative/map/non_cv_object_types.verify.cpp libcxx/test/libcxx/containers/associative/multimap/non_cv_object_types.verify.cpp libcxx/test/libcxx/containers/associative/multiset/non_cv_object_types.verify.cpp libcxx/test/libcxx/containers/associative/set/non_cv_object_types.verify.cpp libcxx/test/libcxx/containers/sequences/array/non_cv_objects.verify.cpp libcxx/test/libcxx/containers/sequences/deque/non_cv_objects.verify.cpp libcxx/test/libcxx/containers/sequences/forward_list/non_cv_objects.verify.cpp libcxx/test/libcxx/containers/sequences/list/non_cv_objects.verify.cpp libcxx/test/libcxx/containers/sequences/vector/non_cv_objects.verify.cpp libcxx/test/libcxx/containers/strings/basic.string/non_cv_objects.verify.cpp libcxx/test/libcxx/containers/unord/unord.map/non_cv_object_types.verify.cpp libcxx/test/libcxx/containers/unord/unord.multimap/non_cv_object_types.verify.cpp libcxx/test/libcxx/containers/unord/unord.multiset/non_cv_object_types.verify.cpp libcxx/test/libcxx/containers/unord/unord.set/non_cv_object_types.verify.cpp libcxx/test/libcxx/memory/allocator_non_cv_objects_only.verify.cpp libcxx/include/__memory/allocator.h libcxx/include/array libcxx/include/deque libcxx/include/forward_list libcxx/include/list libcxx/include/map libcxx/include/set libcxx/include/string libcxx/include/unordered_map libcxx/include/unordered_set libcxx/include/vector
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/include/array b/libcxx/include/array
index 0476f57a86..6394564e77 100644
--- a/libcxx/include/array
+++ b/libcxx/include/array
@@ -171,9 +171,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, size_t _Size>
struct _LIBCPP_TEMPLATE_VIS array {
- static_assert(!is_reference<_Tp>::value || !is_function<typename remove_reference<_Tp>::type>::value, "'std::array' can only hold object types; function references are not objects (consider using a function pointer)");
+ static_assert(!is_reference<_Tp>::value || !is_function<typename remove_reference<_Tp>::type>::value,
+ "'std::array' can only hold object types; function references are not objects (consider using a "
+ "function pointer)");
static_assert(!is_reference<_Tp>::value, "'std::array' can only hold object types; references are not objects");
- static_assert(!is_function<_Tp>::value, "'std::array' can only hold object types; functions are not objects (consider using a function pointer)");
+ static_assert(
+ !is_function<_Tp>::value,
+ "'std::array' can only hold object types; functions are not objects (consider using a function pointer)");
static_assert(!is_void<_Tp>::value, "'std::array' can only hold object types; 'void' is not an object");
using __trivially_relocatable = __conditional_t<__libcpp_is_trivially_relocatable<_Tp>::value, array, void>;
diff --git a/libcxx/include/deque b/libcxx/include/deque
index df0ddaebc3..98e760ef04 100644
--- a/libcxx/include/deque
+++ b/libcxx/include/deque
@@ -476,10 +476,15 @@ template <class _Tp, class _Allocator /*= allocator<_Tp>*/>
class _LIBCPP_TEMPLATE_VIS deque {
static_assert(!is_const<_Tp>::value, "'std::deque' can only hold non-const types");
static_assert(!is_volatile<_Tp>::value, "'std::deque' can only hold non-volatile types");
- static_assert(!is_reference<_Tp>::value || !is_function<typename remove_reference<_Tp>::type>::value, "'std::deque' can only hold object types; function references are not objects (consider using a function pointer)");
+ static_assert(!is_reference<_Tp>::value || !is_function<typename remove_reference<_Tp>::type>::value,
+ "'std::deque' can only hold object types; function references are not objects (consider using a "
+ "function pointer)");
static_assert(!is_reference<_Tp>::value, "'std::deque' can only hold object types; references are not objects");
- static_assert(!is_function<_Tp>::value, "'std::deque' can only hold object types; functions are not objects (consider using a function pointer)");
+ static_assert(
+ !is_function<_Tp>::value,
+ "'std::deque' can only hold object types; functions are not objects (consider using a function pointer)");
static_assert(!is_void<_Tp>::value, "'std::deque' can only hold object types; 'void' is not an object");
+
public:
// types:
diff --git a/libcxx/include/forward_list b/libcxx/include/forward_list
index 2b6ad3bc10..8906792260 100644
--- a/libcxx/include/forward_list
+++ b/libcxx/include/forward_list
@@ -649,115 +649,115 @@ void __forward_list_base<_Tp, _Alloc>::clear() _NOEXCEPT {
template <class _Tp, class _Alloc>
class _LIBCPP_TEMPLATE_VIS __forward_list_base<_Tp const, _Alloc> {
public:
- using __node_allocator = void*;
+ using __node_allocator = void*;
using __node_alloc_traits = void*;
- using __node_pointer = void*;
- using __node_type = void*;
- using __node_base = void*;
+ using __node_pointer = void*;
+ using __node_type = void*;
+ using __node_base = void*;
using __node_base_pointer = void*;
- using __link_pointer = void*;
+ using __link_pointer = void*;
- using pointer = int*;
- using const_pointer = int const*;
- using size_type = unsigned int;
+ using pointer = int*;
+ using const_pointer = int const*;
+ using size_type = unsigned int;
using difference_type = int;
- using iterator = int*;
- using const_iterator = int const*;
+ using iterator = int*;
+ using const_iterator = int const*;
};
template <class _Tp, class _Alloc>
class _LIBCPP_TEMPLATE_VIS __forward_list_base<_Tp volatile, _Alloc> {
public:
- using __node_allocator = void*;
+ using __node_allocator = void*;
using __node_alloc_traits = void*;
- using __node_pointer = void*;
- using __node_type = void*;
- using __node_base = void*;
+ using __node_pointer = void*;
+ using __node_type = void*;
+ using __node_base = void*;
using __node_base_pointer = void*;
- using __link_pointer = void*;
+ using __link_pointer = void*;
- using pointer = int*;
- using const_pointer = int const*;
- using size_type = unsigned int;
+ using pointer = int*;
+ using const_pointer = int const*;
+ using size_type = unsigned int;
using difference_type = int;
- using iterator = int*;
- using const_iterator = int const*;
+ using iterator = int*;
+ using const_iterator = int const*;
};
template <class _Tp, class _Alloc>
class _LIBCPP_TEMPLATE_VIS __forward_list_base<_Tp&, _Alloc> {
public:
- using __node_allocator = void*;
+ using __node_allocator = void*;
using __node_alloc_traits = void*;
- using __node_pointer = void*;
- using __node_type = void*;
- using __node_base = void*;
+ using __node_pointer = void*;
+ using __node_type = void*;
+ using __node_base = void*;
using __node_base_pointer = void*;
- using __link_pointer = void*;
+ using __link_pointer = void*;
- using pointer = int*;
- using const_pointer = int const*;
- using size_type = unsigned int;
+ using pointer = int*;
+ using const_pointer = int const*;
+ using size_type = unsigned int;
using difference_type = int;
- using iterator = int*;
- using const_iterator = int const*;
+ using iterator = int*;
+ using const_iterator = int const*;
};
template <class _Tp, class _Alloc>
class _LIBCPP_TEMPLATE_VIS __forward_list_base<_Tp&&, _Alloc> {
public:
- using __node_allocator = void*;
+ using __node_allocator = void*;
using __node_alloc_traits = void*;
- using __node_pointer = void*;
- using __node_type = void*;
- using __node_base = void*;
+ using __node_pointer = void*;
+ using __node_type = void*;
+ using __node_base = void*;
using __node_base_pointer = void*;
- using __link_pointer = void*;
+ using __link_pointer = void*;
- using pointer = int*;
- using const_pointer = int const*;
- using size_type = unsigned int;
+ using pointer = int*;
+ using const_pointer = int const*;
+ using size_type = unsigned int;
using difference_type = int;
- using iterator = int*;
- using const_iterator = int const*;
+ using iterator = int*;
+ using const_iterator = int const*;
};
template <class _Tp, class... _Args, class _Alloc>
class _LIBCPP_TEMPLATE_VIS __forward_list_base<_Tp(_Args...), _Alloc> {
public:
- using __node_allocator = void*;
+ using __node_allocator = void*;
using __node_alloc_traits = void*;
- using __node_pointer = void*;
- using __node_type = void*;
- using __node_base = void*;
+ using __node_pointer = void*;
+ using __node_type = void*;
+ using __node_base = void*;
using __node_base_pointer = void*;
- using __link_pointer = void*;
+ using __link_pointer = void*;
- using pointer = int*;
- using const_pointer = int const*;
- using size_type = unsigned int;
+ using pointer = int*;
+ using const_pointer = int const*;
+ using size_type = unsigned int;
using difference_type = int;
- using iterator = int*;
- using const_iterator = int const*;
+ using iterator = int*;
+ using const_iterator = int const*;
};
template <class _Alloc>
class _LIBCPP_TEMPLATE_VIS __forward_list_base<void, _Alloc> {
public:
- using __node_allocator = void*;
+ using __node_allocator = void*;
using __node_alloc_traits = void*;
- using __node_pointer = void*;
- using __node_type = void*;
- using __node_base = void*;
+ using __node_pointer = void*;
+ using __node_type = void*;
+ using __node_base = void*;
using __node_base_pointer = void*;
- using __link_pointer = void*;
+ using __link_pointer = void*;
- using pointer = int*;
- using const_pointer = int const*;
- using size_type = unsigned int;
+ using pointer = int*;
+ using const_pointer = int const*;
+ using size_type = unsigned int;
using difference_type = int;
- using iterator = int*;
- using const_iterator = int const*;
+ using iterator = int*;
+ using const_iterator = int const*;
};
// end-diagnostic-helpers
@@ -765,9 +765,14 @@ template <class _Tp, class _Alloc /*= allocator<_Tp>*/>
class _LIBCPP_TEMPLATE_VIS forward_list : private __forward_list_base<_Tp, _Alloc> {
static_assert(!is_const<_Tp>::value, "'std::forward_list' can only hold non-const types");
static_assert(!is_volatile<_Tp>::value, "'std::forward_list' can only hold non-volatile types");
- static_assert(!is_reference<_Tp>::value || !is_function<typename remove_reference<_Tp>::type>::value, "'std::forward_list' can only hold object types; function references are not objects (consider using a function pointer)");
- static_assert(!is_reference<_Tp>::value, "'std::forward_list' can only hold object types; references are not objects");
- static_assert(!is_function<_Tp>::value, "'std::forward_list' can only hold object types; functions are not objects (consider using a function pointer)");
+ static_assert(!is_reference<_Tp>::value || !is_function<typename remove_reference<_Tp>::type>::value,
+ "'std::forward_list' can only hold object types; function references are not objects (consider using a "
+ "function pointer)");
+ static_assert(!is_reference<_Tp>::value,
+ "'std::forward_list' can only hold object types; references are not objects");
+ static_assert(
+ !is_function<_Tp>::value,
+ "'std::forward_list' can only hold object types; functions are not objects (consider using a function pointer)");
static_assert(!is_void<_Tp>::value, "'std::forward_list' can only hold object types; 'void' is not an object");
typedef __forward_list_base<_Tp, _Alloc> base;
diff --git a/libcxx/include/list b/libcxx/include/list
index 8da28ff187..e04db8e38d 100644
--- a/libcxx/include/list
+++ b/libcxx/include/list
@@ -674,115 +674,115 @@ void __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
template <class _Tp, class _Alloc>
class _LIBCPP_TEMPLATE_VIS __list_imp<_Tp const, _Alloc> {
public:
- using __node_allocator = void*;
+ using __node_allocator = void*;
using __node_alloc_traits = void*;
- using __node_pointer = void*;
- using __node_type = void*;
- using __node_base = void*;
+ using __node_pointer = void*;
+ using __node_type = void*;
+ using __node_base = void*;
using __node_base_pointer = void*;
- using __link_pointer = void*;
+ using __link_pointer = void*;
- using pointer = int*;
- using const_pointer = int const*;
- using size_type = unsigned int;
+ using pointer = int*;
+ using const_pointer = int const*;
+ using size_type = unsigned int;
using difference_type = int;
- using iterator = int*;
- using const_iterator = int const*;
+ using iterator = int*;
+ using const_iterator = int const*;
};
template <class _Tp, class _Alloc>
class _LIBCPP_TEMPLATE_VIS __list_imp<_Tp volatile, _Alloc> {
public:
- using __node_allocator = void*;
+ using __node_allocator = void*;
using __node_alloc_traits = void*;
- using __node_pointer = void*;
- using __node_type = void*;
- using __node_base = void*;
+ using __node_pointer = void*;
+ using __node_type = void*;
+ using __node_base = void*;
using __node_base_pointer = void*;
- using __link_pointer = void*;
+ using __link_pointer = void*;
- using pointer = int*;
- using const_pointer = int const*;
- using size_type = unsigned int;
+ using pointer = int*;
+ using const_pointer = int const*;
+ using size_type = unsigned int;
using difference_type = int;
- using iterator = int*;
- using const_iterator = int const*;
+ using iterator = int*;
+ using const_iterator = int const*;
};
template <class _Tp, class _Alloc>
class _LIBCPP_TEMPLATE_VIS __list_imp<_Tp&, _Alloc> {
public:
- using __node_allocator = void*;
+ using __node_allocator = void*;
using __node_alloc_traits = void*;
- using __node_pointer = void*;
- using __node_type = void*;
- using __node_base = void*;
+ using __node_pointer = void*;
+ using __node_type = void*;
+ using __node_base = void*;
using __node_base_pointer = void*;
- using __link_pointer = void*;
+ using __link_pointer = void*;
- using pointer = int*;
- using const_pointer = int const*;
- using size_type = unsigned int;
+ using pointer = int*;
+ using const_pointer = int const*;
+ using size_type = unsigned int;
using difference_type = int;
- using iterator = int*;
- using const_iterator = int const*;
+ using iterator = int*;
+ using const_iterator = int const*;
};
template <class _Tp, class _Alloc>
class _LIBCPP_TEMPLATE_VIS __list_imp<_Tp&&, _Alloc> {
public:
- using __node_allocator = void*;
+ using __node_allocator = void*;
using __node_alloc_traits = void*;
- using __node_pointer = void*;
- using __node_type = void*;
- using __node_base = void*;
+ using __node_pointer = void*;
+ using __node_type = void*;
+ using __node_base = void*;
using __node_base_pointer = void*;
- using __link_pointer = void*;
+ using __link_pointer = void*;
- using pointer = int*;
- using const_pointer = int const*;
- using size_type = unsigned int;
+ using pointer = int*;
+ using const_pointer = int const*;
+ using size_type = unsigned int;
using difference_type = int;
- using iterator = int*;
- using const_iterator = int const*;
+ using iterator = int*;
+ using const_iterator = int const*;
};
template <class _Tp, class... _Args, class _Alloc>
class _LIBCPP_TEMPLATE_VIS __list_imp<_Tp(_Args...), _Alloc> {
public:
- using __node_allocator = void*;
+ using __node_allocator = void*;
using __node_alloc_traits = void*;
- using __node_pointer = void*;
- using __node_type = void*;
- using __node_base = void*;
+ using __node_pointer = void*;
+ using __node_type = void*;
+ using __node_base = void*;
using __node_base_pointer = void*;
- using __link_pointer = void*;
+ using __link_pointer = void*;
- using pointer = int*;
- using const_pointer = int const*;
- using size_type = unsigned int;
+ using pointer = int*;
+ using const_pointer = int const*;
+ using size_type = unsigned int;
using difference_type = int;
- using iterator = int*;
- using const_iterator = int const*;
+ using iterator = int*;
+ using const_iterator = int const*;
};
template <class _Alloc>
class _LIBCPP_TEMPLATE_VIS __list_imp<void, _Alloc> {
public:
- using __node_allocator = void*;
+ using __node_allocator = void*;
using __node_alloc_traits = void*;
- using __node_pointer = void*;
- using __node_type = void*;
- using __node_base = void*;
+ using __node_pointer = void*;
+ using __node_type = void*;
+ using __node_base = void*;
using __node_base_pointer = void*;
- using __link_pointer = void*;
+ using __link_pointer = void*;
- using pointer = int*;
- using const_pointer = int const*;
- using size_type = unsigned int;
+ using pointer = int*;
+ using const_pointer = int const*;
+ using size_type = unsigned int;
using difference_type = int;
- using iterator = int*;
- using const_iterator = int const*;
+ using iterator = int*;
+ using const_iterator = int const*;
};
// end-diagnostic-helpers
@@ -790,9 +790,13 @@ template <class _Tp, class _Alloc /*= allocator<_Tp>*/>
class _LIBCPP_TEMPLATE_VIS list : private __list_imp<_Tp, _Alloc> {
static_assert(!is_const<_Tp>::value, "'std::list' can only hold non-const types");
static_assert(!is_volatile<_Tp>::value, "'std::list' can only hold non-volatile types");
- static_assert(!is_reference<_Tp>::value || !is_function<typename remove_reference<_Tp>::type>::value, "'std::list' can only hold object types; function references are not objects (consider using a function pointer)");
+ static_assert(!is_reference<_Tp>::value || !is_function<typename remove_reference<_Tp>::type>::value,
+ "'std::list' can only hold object types; function references are not objects (consider using a "
+ "function pointer)");
static_assert(!is_reference<_Tp>::value, "'std::list' can only hold object types; references are not objects");
- static_assert(!is_function<_Tp>::value, "'std::list' can only hold object types; functions are not objects (consider using a function pointer)");
+ static_assert(
+ !is_function<_Tp>::value,
+ "'std::list' can only hold object types; functions are not objects (consider using a function pointer)");
static_assert(!is_void<_Tp>::value, "'std::list' can only hold object types; 'void' is not an object");
typedef __list_imp<_Tp, _Alloc> base;
diff --git a/libcxx/include/map b/libcxx/include/map
index 3a801c0162..2198146cd8 100644
--- a/libcxx/include/map
+++ b/libcxx/include/map
@@ -965,13 +965,21 @@ public:
template <class _Key, class _Tp, class _Compare = less<_Key>, class _Allocator = allocator<pair<const _Key, _Tp> > >
class _LIBCPP_TEMPLATE_VIS map {
- static_assert(!is_lvalue_reference<_Key>::value || !is_function<typename remove_reference<_Key>::type>::value, "'std::map::key_type' can only hold object types; function references are not objects (consider using a function pointer)");
- static_assert(!is_lvalue_reference<_Key>::value, "'std::map::key_type' can only hold object types; references are not objects");
- static_assert(!is_function<_Key>::value, "'std::map::key_type' can only hold object types; functions are not objects (consider using a function pointer)");
+ static_assert(!is_lvalue_reference<_Key>::value || !is_function<typename remove_reference<_Key>::type>::value,
+ "'std::map::key_type' can only hold object types; function references are not objects (consider using "
+ "a function pointer)");
+ static_assert(!is_lvalue_reference<_Key>::value,
+ "'std::map::key_type' can only hold object types; references are not objects");
+ static_assert(
+ !is_function<_Key>::value,
+ "'std::map::key_type' can only hold object types; functions are not objects (consider using a function pointer)");
static_assert(!is_void<_Key>::value, "'std::map::key_type' can only hold object types; 'void' is not an object");
- static_assert(!is_function<_Tp>::value, "'std::map::mapped_type' can only hold object or reference types; functions are neither (consider using a function pointer or reference)");
+ static_assert(!is_function<_Tp>::value,
+ "'std::map::mapped_type' can only hold object or reference types; functions are neither (consider "
+ "using a function pointer or reference)");
static_assert(!is_void<_Tp>::value, "'std::map::mapped_type' can only hold object types; 'void' is not an object");
+
public:
// types:
typedef _Key key_type;
@@ -1649,13 +1657,22 @@ erase_if(map<_Key, _Tp, _Compare, _Allocator>& __c, _Predicate __pred) {
template <class _Key, class _Tp, class _Compare = less<_Key>, class _Allocator = allocator<pair<const _Key, _Tp> > >
class _LIBCPP_TEMPLATE_VIS multimap {
- static_assert(!is_lvalue_reference<_Key>::value || !is_function<typename remove_reference<_Key>::type>::value, "'std::multimap::key_type' can only hold object types; function references are not objects (consider using a function pointer)");
- static_assert(!is_lvalue_reference<_Key>::value, "'std::multimap::key_type' can only hold object types; references are not objects");
- static_assert(!is_function<_Key>::value, "'std::multimap::key_type' can only hold object types; functions are not objects (consider using a function pointer)");
+ static_assert(!is_lvalue_reference<_Key>::value || !is_function<typename remove_reference<_Key>::type>::value,
+ "'std::multimap::key_type' can only hold object types; function references are not objects (consider "
+ "using a function pointer)");
+ static_assert(!is_lvalue_reference<_Key>::value,
+ "'std::multimap::key_type' can only hold object types; references are not objects");
+ static_assert(!is_function<_Key>::value,
+ "'std::multimap::key_type' can only hold object types; functions are not objects (consider using a "
+ "function pointer)");
static_assert(!is_void<_Key>::value, "'std::multimap::key_type' can only hold object types; 'void' is not an object");
- static_assert(!is_function<_Tp>::value, "'std::multimap::mapped_type' can only hold object or reference types; functions are neither (consider using a function pointer or reference)");
- static_assert(!is_void<_Tp>::value, "'std::multimap::mapped_type' can only hold object types; 'void' is not an object");
+ static_assert(!is_function<_Tp>::value,
+ "'std::multimap::mapped_type' can only hold object or reference types; functions are neither (consider "
+ "using a function pointer or reference)");
+ static_assert(!is_void<_Tp>::value,
+ "'std::multimap::mapped_type' can only hold object types; 'void' is not an object");
+
public:
// types:
typedef _Key key_type;
diff --git a/libcxx/include/set b/libcxx/include/set
index c5c1f66428..ca0608a83f 100644
--- a/libcxx/include/set
+++ b/libcxx/include/set
@@ -569,10 +569,14 @@ template <class _Key, class _Compare = less<_Key>, class _Allocator = allocator<
class _LIBCPP_TEMPLATE_VIS set {
static_assert(!is_const<_Key>::value, "'std::set' can only hold non-const types");
static_assert(!is_volatile<_Key>::value, "'std::set' can only hold non-volatile types");
- static_assert(!is_reference<_Key>::value || !is_function<typename remove_reference<_Key>::type>::value, "'std::set' can only hold object types; function references are not objects (consider using a function pointer)");
+ static_assert(
+ !is_reference<_Key>::value || !is_function<typename remove_reference<_Key>::type>::value,
+ "'std::set' can only hold object types; function references are not objects (consider using a function pointer)");
static_assert(!is_reference<_Key>::value, "'std::set' can only hold object types; references are not objects");
- static_assert(!is_function<_Key>::value, "'std::set' can only hold object types; functions are not objects (consider using a function pointer)");
+ static_assert(!is_function<_Key>::value,
+ "'std::set' can only hold object types; functions are not objects (consider using a function pointer)");
static_assert(!is_void<_Key>::value, "'std::set' can only hold object types; 'void' is not an object");
+
public:
// types:
typedef _Key key_type;
@@ -1029,10 +1033,15 @@ template <class _Key, class _Compare = less<_Key>, class _Allocator = allocator<
class _LIBCPP_TEMPLATE_VIS multiset {
static_assert(!is_const<_Key>::value, "'std::multiset' can only hold non-const types");
static_assert(!is_volatile<_Key>::value, "'std::multiset' can only hold non-volatile types");
- static_assert(!is_reference<_Key>::value || !is_function<typename remove_reference<_Key>::type>::value, "'std::multiset' can only hold object types; function references are not objects (consider using a function pointer)");
+ static_assert(!is_reference<_Key>::value || !is_function<typename remove_reference<_Key>::type>::value,
+ "'std::multiset' can only hold object types; function references are not objects (consider using a "
+ "function pointer)");
static_assert(!is_reference<_Key>::value, "'std::multiset' can only hold object types; references are not objects");
- static_assert(!is_function<_Key>::value, "'std::multiset' can only hold object types; functions are not objects (consider using a function pointer)");
+ static_assert(
+ !is_function<_Key>::value,
+ "'std::multiset' can only hold object types; functions are not objects (consider using a function pointer)");
static_assert(!is_void<_Key>::value, "'std::multiset' can only hold object types; 'void' is not an object");
+
public:
// types:
typedef _Key key_type;
diff --git a/libcxx/include/string b/libcxx/include/string
index 3611e2c7b8..b3de43318c 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -759,9 +759,14 @@ class basic_string {
private:
static_assert(!is_const<_CharT>::value, "'std::basic_string' can only hold non-const types");
static_assert(!is_volatile<_CharT>::value, "'std::basic_string' can only hold non-volatile types");
- static_assert(!is_reference<_CharT>::value || !is_function<typename remove_reference<_CharT>::type>::value, "'std::basic_string' can only hold object types; function references are not objects (consider using a function pointer)");
- static_assert(!is_reference<_CharT>::value, "'std::basic_string' can only hold object types; references are not objects");
- static_assert(!is_function<_CharT>::value, "'std::basic_string' can only hold object types; functions are not objects (consider using a function pointer)");
+ static_assert(!is_reference<_CharT>::value || !is_function<typename remove_reference<_CharT>::type>::value,
+ "'std::basic_string' can only hold object types; function references are not objects (consider using a "
+ "function pointer)");
+ static_assert(!is_reference<_CharT>::value,
+ "'std::basic_string' can only hold object types; references are not objects");
+ static_assert(
+ !is_function<_CharT>::value,
+ "'std::basic_string' can only hold object types; functions are not objects (consider using a function pointer)");
static_assert(!is_void<_CharT>::value, "'std::basic_string' can only hold object types; 'void' is not an object");
using __default_allocator_type = allocator<_CharT>;
diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map
index eadafa4ad3..c5591ab3b8 100644
--- a/libcxx/include/unordered_map
+++ b/libcxx/include/unordered_map
@@ -1027,13 +1027,23 @@ template <class _Key,
class _Pred = equal_to<_Key>,
class _Alloc = allocator<pair<const _Key, _Tp> > >
class _LIBCPP_TEMPLATE_VIS unordered_map {
- static_assert(!is_reference<_Key>::value || !is_function<typename remove_reference<_Key>::type>::value, "'std::unordered_map::key_type' can only hold object types; function references are not objects (consider using a function pointer)");
- static_assert(!is_reference<_Key>::value, "'std::unordered_map::key_type' can only hold object types; references are not objects");
- static_assert(!is_function<_Key>::value, "'std::unordered_map::key_type' can only hold object types; functions are not objects (consider using a function pointer)");
- static_assert(!is_void<_Key>::value, "'std::unordered_map::key_type' can only hold object types; 'void' is not an object");
+ static_assert(!is_reference<_Key>::value || !is_function<typename remove_reference<_Key>::type>::value,
+ "'std::unordered_map::key_type' can only hold object types; function references are not objects "
+ "(consider using a function pointer)");
+ static_assert(!is_reference<_Key>::value,
+ "'std::unordered_map::key_type' can only hold object types; references are not objects");
+ static_assert(!is_function<_Key>::value,
+ "'std::unordered_map::key_type' can only hold object types; functions are not objects (consider using "
+ "a function pointer)");
+ static_assert(!is_void<_Key>::value,
+ "'std::unordered_map::key_type' can only hold object types; 'void' is not an object");
+
+ static_assert(!is_function<_Tp>::value,
+ "'std::unordered_map::mapped_type' can only hold object or reference types; functions are neither "
+ "(consider using a function pointer or reference)");
+ static_assert(!is_void<_Tp>::value,
+ "'std::unordered_map::mapped_type' can only hold object types; 'void' is not an object");
- static_assert(!is_function<_Tp>::value, "'std::unordered_map::mapped_type' can only hold object or reference types; functions are neither (consider using a function pointer or reference)");
- static_assert(!is_void<_Tp>::value, "'std::unordered_map::mapped_type' can only hold object types; 'void' is not an object");
public:
// types
typedef _Key key_type;
@@ -1837,13 +1847,23 @@ template <class _Key,
class _Pred = equal_to<_Key>,
class _Alloc = allocator<pair<const _Key, _Tp> > >
class _LIBCPP_TEMPLATE_VIS unordered_multimap {
- static_assert(!is_reference<_Key>::value || !is_function<typename remove_reference<_Key>::type>::value, "'std::unordered_multimap::key_type' can only hold object types; function references are not objects (consider using a function pointer)");
- static_assert(!is_reference<_Key>::value, "'std::unordered_multimap::key_type' can only hold object types; references are not objects");
- static_assert(!is_function<_Key>::value, "'std::unordered_multimap::key_type' can only hold object types; functions are not objects (consider using a function pointer)");
- static_assert(!is_void<_Key>::value, "'std::unordered_multimap::key_type' can only hold object types; 'void' is not an object");
+ static_assert(!is_reference<_Key>::value || !is_function<typename remove_reference<_Key>::type>::value,
+ "'std::unordered_multimap::key_type' can only hold object types; function references are not objects "
+ "(consider using a function pointer)");
+ static_assert(!is_reference<_Key>::value,
+ "'std::unordered_multimap::key_type' can only hold object types; references are not objects");
+ static_assert(!is_function<_Key>::value,
+ "'std::unordered_multimap::key_type' can only hold object types; functions are not objects (consider "
+ "using a function pointer)");
+ static_assert(!is_void<_Key>::value,
+ "'std::unordered_multimap::key_type' can only hold object types; 'void' is not an object");
+
+ static_assert(!is_function<_Tp>::value,
+ "'std::unordered_multimap::mapped_type' can only hold object or reference types; functions are neither "
+ "(consider using a function pointer or reference)");
+ static_assert(!is_void<_Tp>::value,
+ "'std::unordered_multimap::mapped_type' can only hold object types; 'void' is not an object");
- static_assert(!is_function<_Tp>::value, "'std::unordered_multimap::mapped_type' can only hold object or reference types; functions are neither (consider using a function pointer or reference)");
- static_assert(!is_void<_Tp>::value, "'std::unordered_multimap::mapped_type' can only hold object types; 'void' is not an object");
public:
// types
typedef _Key key_type;
diff --git a/libcxx/include/unordered_set b/libcxx/include/unordered_set
index ffa920fa2b..cd579dd190 100644
--- a/libcxx/include/unordered_set
+++ b/libcxx/include/unordered_set
@@ -550,10 +550,10 @@ template <class Value, class Hash, class Pred, class Alloc>
#include <__ranges/from_range.h>
#include <__type_traits/is_allocator.h>
#include <__type_traits/is_const.h>
-#include <__type_traits/is_volatile.h>
-#include <__type_traits/is_reference.h>
#include <__type_traits/is_function.h>
+#include <__type_traits/is_reference.h>
#include <__type_traits/is_void.h>
+#include <__type_traits/is_volatile.h>
#include <__type_traits/remove_reference.h>
#include <__utility/forward.h>
#include <version>
@@ -587,10 +587,16 @@ template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Valu
class _LIBCPP_TEMPLATE_VIS unordered_set {
static_assert(!is_const<_Value>::value, "'std::unordered_set' can only hold non-const types");
static_assert(!is_volatile<_Value>::value, "'std::unordered_set' can only hold non-volatile types");
- static_assert(!is_reference<_Value>::value || !is_function<typename remove_reference<_Value>::type>::value, "'std::unordered_set' can only hold object types; function references are not objects (consider using a function pointer)");
- static_assert(!is_reference<_Value>::value, "'std::unordered_set' can only hold object types; references are not objects");
- static_assert(!is_function<_Value>::value, "'std::unordered_set' can only hold object types; functions are not objects (consider using a function pointer)");
+ static_assert(!is_reference<_Value>::value || !is_function<typename remove_reference<_Value>::type>::value,
+ "'std::unordered_set' can only hold object types; function references are not objects (consider using "
+ "a function pointer)");
+ static_assert(!is_reference<_Value>::value,
+ "'std::unordered_set' can only hold object types; references are not objects");
+ static_assert(
+ !is_function<_Value>::value,
+ "'std::unordered_set' can only hold object types; functions are not objects (consider using a function pointer)");
static_assert(!is_void<_Value>::value, "'std::unordered_set' can only hold object types; 'void' is not an object");
+
public:
// types
typedef _Value key_type;
@@ -1188,10 +1194,17 @@ template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Valu
class _LIBCPP_TEMPLATE_VIS unordered_multiset {
static_assert(!is_const<_Value>::value, "'std::unordered_multiset' can only hold non-const types");
static_assert(!is_volatile<_Value>::value, "'std::unordered_multiset' can only hold non-volatile types");
- static_assert(!is_reference<_Value>::value || !is_function<typename remove_reference<_Value>::type>::value, "'std::unordered_multiset' can only hold object types; function references are not objects (consider using a function pointer)");
- static_assert(!is_reference<_Value>::value, "'std::unordered_multiset' can only hold object types; references are not objects");
- static_assert(!is_function<_Value>::value, "'std::unordered_multiset' can only hold object types; functions are not objects (consider using a function pointer)");
- static_assert(!is_void<_Value>::value, "'std::unordered_multiset' can only hold object types; 'void' is not an object");
+ static_assert(!is_reference<_Value>::value || !is_function<typename remove_reference<_Value>::type>::value,
+ "'std::unordered_multiset' can only hold object types; function references are not objects (consider "
+ "using a function pointer)");
+ static_assert(!is_reference<_Value>::value,
+ "'std::unordered_multiset' can only hold object types; references are not objects");
+ static_assert(!is_function<_Value>::value,
+ "'std::unordered_multiset' can only hold object types; functions are not objects (consider using a "
+ "function pointer)");
+ static_assert(!is_void<_Value>::value,
+ "'std::unordered_multiset' can only hold object types; 'void' is not an object");
+
public:
// types
typedef _Value key_type;
diff --git a/libcxx/include/vector b/libcxx/include/vector
index 21b528be1d..3b8a77af4a 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -353,8 +353,8 @@ template<class T, class charT> requires is-vector-bool-reference<T> // Since C++
#include <__type_traits/is_reference.h>
#include <__type_traits/is_void.h>
#include <__type_traits/is_volatile.h>
-#include <__type_traits/remove_reference.h>
#include <__type_traits/noexcept_move_assign_container.h>
+#include <__type_traits/remove_reference.h>
#include <__type_traits/type_identity.h>
#include <__utility/exception_guard.h>
#include <__utility/forward.h>
@@ -395,9 +395,13 @@ class _LIBCPP_TEMPLATE_VIS vector {
private:
static_assert(!is_const<_Tp>::value, "'std::vector' can only hold non-const types");
static_assert(!is_volatile<_Tp>::value, "'std::vector' can only hold non-volatile types");
- static_assert(!is_reference<_Tp>::value || !is_function<typename remove_reference<_Tp>::type>::value, "'std::vector' can only hold object types; function references are not objects (consider using a function pointer)");
+ static_assert(!is_reference<_Tp>::value || !is_function<typename remove_reference<_Tp>::type>::value,
+ "'std::vector' can only hold object types; function references are not objects (consider using a "
+ "function pointer)");
static_assert(!is_reference<_Tp>::value, "'std::vector' can only hold object types; references are not objects");
- static_assert(!is_function<_Tp>::value, "'std::vector' can only hold object types; functions are not objects (consider using a function pointer)");
+ static_assert(
+ !is_function<_Tp>::value,
+ "'std::vector' can only hold object types; functions are not objects (consider using a function pointer)");
static_assert(!is_void<_Tp>::value, "'std::vector' can only hold object types; 'void' is not an object");
typedef allocator<_Tp> __default_allocator_type;
``````````
</details>
https://github.com/llvm/llvm-project/pull/106296
More information about the libcxx-commits
mailing list