[libcxx-commits] [libcxx] 224b9d2 - [libc++] Make `<set>` `std::multiset` constexpr as part of P3372R3 (#206257)
via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Jul 5 19:32:52 PDT 2026
Author: Vinay Deshmukh
Date: 2026-07-06T10:32:47+08:00
New Revision: 224b9d2ac05d808aa4b08c27ba37149260310e4b
URL: https://github.com/llvm/llvm-project/commit/224b9d2ac05d808aa4b08c27ba37149260310e4b
DIFF: https://github.com/llvm/llvm-project/commit/224b9d2ac05d808aa4b08c27ba37149260310e4b.diff
LOG: [libc++] Make `<set>` `std::multiset` constexpr as part of P3372R3 (#206257)
Added:
Modified:
libcxx/include/set
libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each.associative.pass.cpp
libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/ranges.for_each.associative.pass.cpp
libcxx/test/std/containers/associative/multiset/clear.pass.cpp
libcxx/test/std/containers/associative/multiset/count.pass.cpp
libcxx/test/std/containers/associative/multiset/count_transparent.pass.cpp
libcxx/test/std/containers/associative/multiset/emplace.pass.cpp
libcxx/test/std/containers/associative/multiset/emplace_hint.pass.cpp
libcxx/test/std/containers/associative/multiset/empty.pass.cpp
libcxx/test/std/containers/associative/multiset/equal_range.pass.cpp
libcxx/test/std/containers/associative/multiset/equal_range_transparent.pass.cpp
libcxx/test/std/containers/associative/multiset/erase_iter.pass.cpp
libcxx/test/std/containers/associative/multiset/erase_iter_iter.pass.cpp
libcxx/test/std/containers/associative/multiset/erase_key.pass.cpp
libcxx/test/std/containers/associative/multiset/extract_iterator.pass.cpp
libcxx/test/std/containers/associative/multiset/extract_key.pass.cpp
libcxx/test/std/containers/associative/multiset/find.pass.cpp
libcxx/test/std/containers/associative/multiset/get_allocator.pass.cpp
libcxx/test/std/containers/associative/multiset/incomplete_type.pass.cpp
libcxx/test/std/containers/associative/multiset/insert_cv.pass.cpp
libcxx/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp
libcxx/test/std/containers/associative/multiset/insert_iter_cv.pass.cpp
libcxx/test/std/containers/associative/multiset/insert_iter_iter.pass.cpp
libcxx/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp
libcxx/test/std/containers/associative/multiset/insert_node_type.pass.cpp
libcxx/test/std/containers/associative/multiset/insert_node_type_hint.pass.cpp
libcxx/test/std/containers/associative/multiset/insert_range.pass.cpp
libcxx/test/std/containers/associative/multiset/insert_rv.pass.cpp
libcxx/test/std/containers/associative/multiset/iterator.pass.cpp
libcxx/test/std/containers/associative/multiset/lower_bound.pass.cpp
libcxx/test/std/containers/associative/multiset/max_size.pass.cpp
libcxx/test/std/containers/associative/multiset/merge.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/alloc.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/compare.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/compare_alloc.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/copy.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/copy_alloc.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/copy_assign.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/deduct.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/default.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/from_range.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare_alloc.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/iter_iter_comp.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.erasure/erase_if.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.nonmember/compare.three_way.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.nonmember/op_compare.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.observers/comp.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.special/member_swap.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp
libcxx/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp
libcxx/test/std/containers/associative/multiset/size.pass.cpp
libcxx/test/std/containers/associative/multiset/upper_bound.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/include/set b/libcxx/include/set
index a8e245b22ae51..0409131ac6981 100644
--- a/libcxx/include/set
+++ b/libcxx/include/set
@@ -1176,31 +1176,34 @@ public:
friend class multiset;
// construct/copy/destroy:
- _LIBCPP_HIDE_FROM_ABI multiset() _NOEXCEPT_(
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multiset() _NOEXCEPT_(
is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_default_constructible<key_compare>::value&&
is_nothrow_copy_constructible<key_compare>::value)
: __tree_(value_compare()) {}
- _LIBCPP_HIDE_FROM_ABI explicit multiset(const value_compare& __comp) _NOEXCEPT_(
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit multiset(const value_compare& __comp) _NOEXCEPT_(
is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_copy_constructible<key_compare>::value)
: __tree_(__comp) {}
- _LIBCPP_HIDE_FROM_ABI explicit multiset(const value_compare& __comp, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit multiset(const value_compare& __comp, const allocator_type& __a)
: __tree_(__comp, __a) {}
template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI multiset(_InputIterator __f, _InputIterator __l, const value_compare& __comp = value_compare())
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
+ multiset(_InputIterator __f, _InputIterator __l, const value_compare& __comp = value_compare())
: __tree_(__comp) {
insert(__f, __l);
}
# if _LIBCPP_STD_VER >= 14
template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI multiset(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 multiset(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
: multiset(__f, __l, key_compare(), __a) {}
# endif
template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
multiset(_InputIterator __f, _InputIterator __l, const value_compare& __comp, const allocator_type& __a)
: __tree_(__comp, __a) {
insert(__f, __l);
@@ -1208,7 +1211,7 @@ public:
# if _LIBCPP_STD_VER >= 23
template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
multiset(from_range_t,
_Range&& __range,
const key_compare& __comp = key_compare(),
@@ -1218,213 +1221,272 @@ public:
}
template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI multiset(from_range_t, _Range&& __range, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
+ multiset(from_range_t, _Range&& __range, const allocator_type& __a)
: multiset(from_range, std::forward<_Range>(__range), key_compare(), __a) {}
# endif
- _LIBCPP_HIDE_FROM_ABI multiset(const multiset& __s) = default;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multiset(const multiset& __s) = default;
- _LIBCPP_HIDE_FROM_ABI multiset& operator=(const multiset& __s) = default;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multiset& operator=(const multiset& __s) = default;
# ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI multiset(multiset&& __s) = default;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multiset(multiset&& __s) = default;
- _LIBCPP_HIDE_FROM_ABI multiset(multiset&& __s, const allocator_type& __a) : __tree_(std::move(__s.__tree_), __a) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multiset(multiset&& __s, const allocator_type& __a)
+ : __tree_(std::move(__s.__tree_), __a) {}
# endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI explicit multiset(const allocator_type& __a) : __tree_(__a) {}
- _LIBCPP_HIDE_FROM_ABI multiset(const multiset& __s, const allocator_type& __a) : __tree_(__s.__tree_, __a) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit multiset(const allocator_type& __a) : __tree_(__a) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multiset(const multiset& __s, const allocator_type& __a)
+ : __tree_(__s.__tree_, __a) {}
# ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
+ multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
: __tree_(__comp) {
insert(__il.begin(), __il.end());
}
- _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
multiset(initializer_list<value_type> __il, const value_compare& __comp, const allocator_type& __a)
: __tree_(__comp, __a) {
insert(__il.begin(), __il.end());
}
# if _LIBCPP_STD_VER >= 14
- _LIBCPP_HIDE_FROM_ABI multiset(initializer_list<value_type> __il, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 multiset(initializer_list<value_type> __il, const allocator_type& __a)
: multiset(__il, key_compare(), __a) {}
# endif
- _LIBCPP_HIDE_FROM_ABI multiset& operator=(initializer_list<value_type> __il) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multiset& operator=(initializer_list<value_type> __il) {
clear();
insert(__il.begin(), __il.end());
return *this;
}
- _LIBCPP_HIDE_FROM_ABI multiset& operator=(multiset&& __s) = default;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multiset& operator=(multiset&& __s) = default;
# endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI ~multiset() {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 ~multiset() {
static_assert(sizeof(std::__diagnose_non_const_comparator<_Key, _Compare>()), "");
}
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __tree_.begin(); }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __tree_.begin(); }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __tree_.end(); }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __tree_.end(); }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator begin() _NOEXCEPT {
+ return __tree_.begin();
+ }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator begin() const _NOEXCEPT {
+ return __tree_.begin();
+ }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator end() _NOEXCEPT {
+ return __tree_.end();
+ }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator end() const _NOEXCEPT {
+ return __tree_.end();
+ }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() _NOEXCEPT { return reverse_iterator(end()); }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const _NOEXCEPT {
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rbegin() _NOEXCEPT {
+ return reverse_iterator(end());
+ }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator
+ rbegin() const _NOEXCEPT {
return const_reverse_iterator(end());
}
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() _NOEXCEPT { return reverse_iterator(begin()); }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const _NOEXCEPT {
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 reverse_iterator rend() _NOEXCEPT {
+ return reverse_iterator(begin());
+ }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator rend() const _NOEXCEPT {
return const_reverse_iterator(begin());
}
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const _NOEXCEPT { return begin(); }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator cend() const _NOEXCEPT { return end(); }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const _NOEXCEPT { return rbegin(); }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const _NOEXCEPT { return rend(); }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cbegin() const _NOEXCEPT {
+ return begin();
+ }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator cend() const _NOEXCEPT {
+ return end();
+ }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator
+ crbegin() const _NOEXCEPT {
+ return rbegin();
+ }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_reverse_iterator crend() const _NOEXCEPT {
+ return rend();
+ }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const _NOEXCEPT { return __tree_.size() == 0; }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type size() const _NOEXCEPT { return __tree_.size(); }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return __tree_.max_size(); }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool empty() const _NOEXCEPT {
+ return __tree_.size() == 0;
+ }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type size() const _NOEXCEPT {
+ return __tree_.size();
+ }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type max_size() const _NOEXCEPT {
+ return __tree_.max_size();
+ }
// modifiers:
# ifndef _LIBCPP_CXX03_LANG
template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI iterator emplace(_Args&&... __args) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator emplace(_Args&&... __args) {
return __tree_.__emplace_multi(std::forward<_Args>(__args)...);
}
template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI iterator emplace_hint(const_iterator __p, _Args&&... __args) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator emplace_hint(const_iterator __p, _Args&&... __args) {
return __tree_.__emplace_hint_multi(__p, std::forward<_Args>(__args)...);
}
# endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI iterator insert(const value_type& __v) { return __tree_.__emplace_multi(__v); }
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, const value_type& __v) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const value_type& __v) {
+ return __tree_.__emplace_multi(__v);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __p, const value_type& __v) {
return __tree_.__emplace_hint_multi(__p, __v);
}
template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __first, _InputIterator __last) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(_InputIterator __first, _InputIterator __last) {
__tree_.__insert_range_multi(__first, __last);
}
# if _LIBCPP_STD_VER >= 23
template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI void insert_range(_Range&& __range) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert_range(_Range&& __range) {
__tree_.__insert_range_multi(ranges::begin(__range), ranges::end(__range));
}
# endif
# ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI iterator insert(value_type&& __v) { return __tree_.__emplace_multi(std::move(__v)); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(value_type&& __v) {
+ return __tree_.__emplace_multi(std::move(__v));
+ }
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __p, value_type&& __v) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __p, value_type&& __v) {
return __tree_.__emplace_hint_multi(__p, std::move(__v));
}
- _LIBCPP_HIDE_FROM_ABI void insert(initializer_list<value_type> __il) { insert(__il.begin(), __il.end()); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(initializer_list<value_type> __il) {
+ insert(__il.begin(), __il.end());
+ }
# endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __tree_.erase(__p); }
- _LIBCPP_HIDE_FROM_ABI size_type erase(const key_type& __k) { return __tree_.__erase_multi(__k); }
- _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __f, const_iterator __l) { return __tree_.erase(__f, __l); }
- _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __tree_.clear(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __p) { return __tree_.erase(__p); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type erase(const key_type& __k) {
+ return __tree_.__erase_multi(__k);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __f, const_iterator __l) {
+ return __tree_.erase(__f, __l);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void clear() _NOEXCEPT { __tree_.clear(); }
# if _LIBCPP_STD_VER >= 17
- _LIBCPP_HIDE_FROM_ABI iterator insert(node_type&& __nh) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(node_type&& __nh) {
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
"node_type with incompatible allocator passed to multiset::insert()");
return __tree_.template __node_handle_insert_multi<node_type>(std::move(__nh));
}
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __hint, node_type&& __nh) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __hint, node_type&& __nh) {
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(__nh.empty() || __nh.get_allocator() == get_allocator(),
"node_type with incompatible allocator passed to multiset::insert()");
return __tree_.template __node_handle_insert_multi<node_type>(__hint, std::move(__nh));
}
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(key_type const& __key) {
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 node_type extract(key_type const& __key) {
return __tree_.template __node_handle_extract<node_type>(__key);
}
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI node_type extract(const_iterator __it) {
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 node_type extract(const_iterator __it) {
return __tree_.template __node_handle_extract<node_type>(__it);
}
template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI void merge(multiset<key_type, _Compare2, allocator_type>& __source) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
+ merge(multiset<key_type, _Compare2, allocator_type>& __source) {
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
__source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
__tree_.__node_handle_merge_multi(__source.__tree_);
}
template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI void merge(multiset<key_type, _Compare2, allocator_type>&& __source) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
+ merge(multiset<key_type, _Compare2, allocator_type>&& __source) {
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
__source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
__tree_.__node_handle_merge_multi(__source.__tree_);
}
template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI void merge(set<key_type, _Compare2, allocator_type>& __source) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void merge(set<key_type, _Compare2, allocator_type>& __source) {
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
__source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
__tree_.__node_handle_merge_multi(__source.__tree_);
}
template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI void merge(set<key_type, _Compare2, allocator_type>&& __source) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void merge(set<key_type, _Compare2, allocator_type>&& __source) {
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
__source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
__tree_.__node_handle_merge_multi(__source.__tree_);
}
# endif
- _LIBCPP_HIDE_FROM_ABI void swap(multiset& __s) _NOEXCEPT_(__is_nothrow_swappable_v<__base>) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(multiset& __s)
+ _NOEXCEPT_(__is_nothrow_swappable_v<__base>) {
__tree_.swap(__s.__tree_);
}
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT { return __tree_.__alloc(); }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __tree_.value_comp(); }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI value_compare value_comp() const { return __tree_.value_comp(); }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 allocator_type get_allocator() const _NOEXCEPT {
+ return __tree_.__alloc();
+ }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 key_compare key_comp() const {
+ return __tree_.value_comp();
+ }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare value_comp() const {
+ return __tree_.value_comp();
+ }
// set operations:
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const key_type& __k) { return __tree_.find(__k); }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const key_type& __k) const { return __tree_.find(__k); }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const key_type& __k) {
+ return __tree_.find(__k);
+ }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const key_type& __k) const {
+ return __tree_.find(__k);
+ }
# if _LIBCPP_STD_VER >= 14
template <typename _K2,
class _Comp = _Compare,
enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator find(const _K2& __k) {
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator find(const _K2& __k) {
return __tree_.find(__k);
}
template <typename _K2,
class _Comp = _Compare,
enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator find(const _K2& __k) const {
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator find(const _K2& __k) const {
return __tree_.find(__k);
}
# endif
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const key_type& __k) const {
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const key_type& __k) const {
return __tree_.__count_multi(__k);
}
# if _LIBCPP_STD_VER >= 14
template <typename _K2, class _Comp = _Compare, enable_if_t<__is_transparent_v<_Comp>, int> = 0>
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI size_type count(const _K2& __k) const {
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type count(const _K2& __k) const {
return __tree_.__count_multi(__k);
}
# endif
# if _LIBCPP_STD_VER >= 20
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const key_type& __k) const { return find(__k) != end(); }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const key_type& __k) const {
+ return find(__k) != end();
+ }
template <typename _K2,
class _Comp = _Compare,
enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool contains(const _K2& __k) const {
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool contains(const _K2& __k) const {
return find(__k) != end();
}
# endif // _LIBCPP_STD_VER >= 20
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const key_type& __k) {
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const key_type& __k) {
return __tree_.__lower_bound_multi(__k);
}
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const key_type& __k) const {
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
+ lower_bound(const key_type& __k) const {
return __tree_.__lower_bound_multi(__k);
}
@@ -1432,23 +1494,25 @@ public:
template <typename _K2,
class _Comp = _Compare,
enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator lower_bound(const _K2& __k) {
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator lower_bound(const _K2& __k) {
return __tree_.__lower_bound_multi(__k);
}
template <typename _K2,
class _Comp = _Compare,
enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator lower_bound(const _K2& __k) const {
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
+ lower_bound(const _K2& __k) const {
return __tree_.__lower_bound_multi(__k);
}
# endif
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const key_type& __k) {
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const key_type& __k) {
return __tree_.__upper_bound_multi(__k);
}
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const key_type& __k) const {
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
+ upper_bound(const key_type& __k) const {
return __tree_.__upper_bound_multi(__k);
}
@@ -1456,30 +1520,35 @@ public:
template <typename _K2,
class _Comp = _Compare,
enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI iterator upper_bound(const _K2& __k) {
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator upper_bound(const _K2& __k) {
return __tree_.__upper_bound_multi(__k);
}
template <typename _K2,
class _Comp = _Compare,
enable_if_t<__is_transparent_v<_Comp> || __is_transparently_comparable_v<_Comp, key_type, _K2>, int> = 0>
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const_iterator upper_bound(const _K2& __k) const {
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const_iterator
+ upper_bound(const _K2& __k) const {
return __tree_.__upper_bound_multi(__k);
}
# endif
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const key_type& __k) {
+ [[__nodiscard__]]
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range(const key_type& __k) {
return __tree_.__equal_range_multi(__k);
}
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
+ equal_range(const key_type& __k) const {
return __tree_.__equal_range_multi(__k);
}
# if _LIBCPP_STD_VER >= 14
template <typename _K2, class _Comp = _Compare, enable_if_t<__is_transparent_v<_Comp>, int> = 0>
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<iterator, iterator> equal_range(const _K2& __k) {
+ [[__nodiscard__]]
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<iterator, iterator> equal_range(const _K2& __k) {
return __tree_.__equal_range_multi(__k);
}
template <typename _K2, class _Comp = _Compare, enable_if_t<__is_transparent_v<_Comp>, int> = 0>
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pair<const_iterator, const_iterator>
+ equal_range(const _K2& __k) const {
return __tree_.__equal_range_multi(__k);
}
# endif
@@ -1543,7 +1612,7 @@ struct __specialized_algorithm<_Alg, __single_range<multiset<_Key, _Compare, _Al
// set's begin() and end() are identical with and without const qualification
template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI static auto operator()(const __set& __set, _Args&&... __args) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static auto operator()(const __set& __set, _Args&&... __args) {
return __specialized_algorithm<_Alg, __single_range<typename __set::__base>>()(
__set.__tree_, std::forward<_Args>(__args)...);
}
@@ -1551,7 +1620,7 @@ struct __specialized_algorithm<_Alg, __single_range<multiset<_Key, _Compare, _Al
# endif
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
operator==(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) {
return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
}
@@ -1559,31 +1628,31 @@ operator==(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key,
# if _LIBCPP_STD_VER <= 17
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
operator<(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) {
return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
}
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
operator!=(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) {
return !(__x == __y);
}
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
operator>(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) {
return __y < __x;
}
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
operator>=(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) {
return !(__x < __y);
}
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
operator<=(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) {
return !(__y < __x);
}
@@ -1591,7 +1660,7 @@ operator<=(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key,
# else // _LIBCPP_STD_VER <= 17
template <class _Key, class _Compare, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<_Key>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __synth_three_way_result<_Key>
operator<=>(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key, _Compare, _Allocator>& __y) {
return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), __synth_three_way);
}
@@ -1599,7 +1668,7 @@ operator<=>(const multiset<_Key, _Compare, _Allocator>& __x, const multiset<_Key
# endif // _LIBCPP_STD_VER <= 17
template <class _Key, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI void
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
swap(multiset<_Key, _Compare, _Allocator>& __x, multiset<_Key, _Compare, _Allocator>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
__x.swap(__y);
@@ -1607,7 +1676,7 @@ swap(multiset<_Key, _Compare, _Allocator>& __x, multiset<_Key, _Compare, _Alloca
# if _LIBCPP_STD_VER >= 20
template <class _Key, class _Compare, class _Allocator, class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI typename multiset<_Key, _Compare, _Allocator>::size_type
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename multiset<_Key, _Compare, _Allocator>::size_type
erase_if(multiset<_Key, _Compare, _Allocator>& __c, _Predicate __pred) {
return std::__libcpp_erase_if_container(__c, __pred);
}
diff --git a/libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each.associative.pass.cpp b/libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each.associative.pass.cpp
index 645e1e4af792e..7b0e5b93dc618 100644
--- a/libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each.associative.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/for_each.associative.pass.cpp
@@ -71,12 +71,8 @@ TEST_CONSTEXPR_CXX26 void test_node_container(Converter conv) {
}
TEST_CONSTEXPR_CXX26 bool test() {
- // FIXME: remove when set is made constexpr
- if (!TEST_IS_CONSTANT_EVALUATED)
- test_node_container<std::set<int> >([](int i) { return i; });
- // FIXME: remove when multiset is made constexpr
- if (!TEST_IS_CONSTANT_EVALUATED)
- test_node_container<std::multiset<int> >([](int i) { return i; });
+ test_node_container<std::set<int> >([](int i) { return i; });
+ test_node_container<std::multiset<int> >([](int i) { return i; });
test_node_container<std::map<int, int> >([](int i) { return std::make_pair(i, i); });
test_node_container<std::multimap<int, int> >([](int i) { return std::make_pair(i, i); });
diff --git a/libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/ranges.for_each.associative.pass.cpp b/libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/ranges.for_each.associative.pass.cpp
index 02698819d71df..72aa40a7f7e0a 100644
--- a/libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/ranges.for_each.associative.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.nonmodifying/alg.foreach/ranges.for_each.associative.pass.cpp
@@ -252,20 +252,13 @@ TEST_CONSTEXPR_CXX26 void test_invoke_map_like() {
}
TEST_CONSTEXPR_CXX26 bool test() {
- if (!TEST_IS_CONSTANT_EVALUATED) {
- // FIXME: remove when multiset is made constexpr
- test_node_container<std::multiset<int> >([](int i) { return i; });
- }
test_node_container<std::set<int> >([](int i) { return i; });
+ test_node_container<std::multiset<int> >([](int i) { return i; });
test_node_container<std::map<int, int> >([](int i) { return std::make_pair(i, i); });
test_node_container<std::multimap<int, int> >([](int i) { return std::make_pair(i, i); });
- if (!TEST_IS_CONSTANT_EVALUATED) {
- // FIXME: remove when multiset is made constexpr
- test_invoke_set_like<std::multiset>();
- }
-
test_invoke_set_like<std::set>();
+ test_invoke_set_like<std::multiset>();
test_invoke_map_like<std::map>();
test_invoke_map_like<std::multimap>();
diff --git a/libcxx/test/std/containers/associative/multiset/clear.pass.cpp b/libcxx/test/std/containers/associative/multiset/clear.pass.cpp
index 61a5f25eac608..b8110efe4a4ff 100644
--- a/libcxx/test/std/containers/associative/multiset/clear.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/clear.pass.cpp
@@ -10,7 +10,7 @@
// class multiset
-// void clear() noexcept;
+// void clear() noexcept; // constexpr since C++26
#include <set>
#include <cassert>
@@ -18,7 +18,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::multiset<int> M;
typedef int V;
@@ -42,5 +42,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/count.pass.cpp b/libcxx/test/std/containers/associative/multiset/count.pass.cpp
index 6ad96b232083c..6bfcdc66aada9 100644
--- a/libcxx/test/std/containers/associative/multiset/count.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/count.pass.cpp
@@ -10,7 +10,7 @@
// class multiset
-// size_type count(const key_type& k) const;
+// size_type count(const key_type& k) const; // constexpr since C++26
#include <set>
#include <cassert>
@@ -19,7 +19,7 @@
#include "min_allocator.h"
#include "private_constructor.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef int V;
typedef std::multiset<int> M;
@@ -124,5 +124,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/count_transparent.pass.cpp b/libcxx/test/std/containers/associative/multiset/count_transparent.pass.cpp
index aea63384887d4..815260f67c231 100644
--- a/libcxx/test/std/containers/associative/multiset/count_transparent.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/count_transparent.pass.cpp
@@ -13,27 +13,39 @@
// class multiset
// template<typename K>
-// size_type count(const K& x) const; // C++14
+// size_type count(const K& x) const; // C++14, constexpr since C++26
#include <cassert>
#include <set>
#include <utility>
+#include "test_macros.h"
+
struct Comp {
using is_transparent = void;
- bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const { return lhs < rhs; }
+ TEST_CONSTEXPR_CXX26 bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const {
+ return lhs < rhs;
+ }
- bool operator()(const std::pair<int, int>& lhs, int rhs) const { return lhs.first < rhs; }
+ TEST_CONSTEXPR_CXX26 bool operator()(const std::pair<int, int>& lhs, int rhs) const { return lhs.first < rhs; }
- bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
+ TEST_CONSTEXPR_CXX26 bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
std::multiset<std::pair<int, int>, Comp> s{{2, 1}, {1, 1}, {1, 1}, {1, 1}, {2, 2}};
auto cnt = s.count(1);
assert(cnt == 3);
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/emplace.pass.cpp b/libcxx/test/std/containers/associative/multiset/emplace.pass.cpp
index 97cae1c565216..193926b6dfc87 100644
--- a/libcxx/test/std/containers/associative/multiset/emplace.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/emplace.pass.cpp
@@ -13,7 +13,7 @@
// class multiset
// template <class... Args>
-// iterator emplace(Args&&... args);
+// iterator emplace(Args&&... args); // constexpr since C++26
#include <cassert>
#include <set>
@@ -23,8 +23,8 @@
#include "MoveOnly.h"
#include "min_allocator.h"
-int main(int, char**) {
- {
+TEST_CONSTEXPR_CXX26 bool test() {
+ if (!TEST_IS_CONSTANT_EVALUATED) {
typedef std::multiset<DefaultOnly> M;
typedef M::iterator R;
M m;
@@ -41,7 +41,9 @@ int main(int, char**) {
assert(*m.begin() == DefaultOnly());
assert(DefaultOnly::count == 2);
}
- assert(DefaultOnly::count == 0);
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ assert(DefaultOnly::count == 0);
+ }
{
typedef std::multiset<Emplaceable> M;
typedef M::iterator R;
@@ -84,5 +86,13 @@ int main(int, char**) {
assert(set.begin() == iter);
}
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/emplace_hint.pass.cpp b/libcxx/test/std/containers/associative/multiset/emplace_hint.pass.cpp
index d8e9d1cd4d1c6..5650b27d19a05 100644
--- a/libcxx/test/std/containers/associative/multiset/emplace_hint.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/emplace_hint.pass.cpp
@@ -13,7 +13,7 @@
// class multiset
// template <class... Args>
-// iterator emplace_hint(const_iterator position, Args&&... args);
+// iterator emplace_hint(const_iterator position, Args&&... args); // constexpr since C++26
#include <set>
#include <cassert>
@@ -23,8 +23,8 @@
#include "DefaultOnly.h"
#include "min_allocator.h"
-int main(int, char**) {
- {
+TEST_CONSTEXPR_CXX26 bool test() {
+ if (!TEST_IS_CONSTANT_EVALUATED) {
typedef std::multiset<DefaultOnly> M;
typedef M::iterator R;
M m;
@@ -41,7 +41,9 @@ int main(int, char**) {
assert(*m.begin() == DefaultOnly());
assert(DefaultOnly::count == 2);
}
- assert(DefaultOnly::count == 0);
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ assert(DefaultOnly::count == 0);
+ }
{
typedef std::multiset<Emplaceable> M;
typedef M::iterator R;
@@ -78,5 +80,13 @@ int main(int, char**) {
assert(*r == 2);
}
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/empty.pass.cpp b/libcxx/test/std/containers/associative/multiset/empty.pass.cpp
index 944f610a0c507..08027484fadb6 100644
--- a/libcxx/test/std/containers/associative/multiset/empty.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/empty.pass.cpp
@@ -10,7 +10,7 @@
// class multiset
-// bool empty() const;
+// bool empty() const; // constexpr since C++26
#include <set>
#include <cassert>
@@ -18,7 +18,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::multiset<int> M;
M m;
@@ -40,5 +40,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/equal_range.pass.cpp b/libcxx/test/std/containers/associative/multiset/equal_range.pass.cpp
index e5c1d2b1eab98..7d623036c8e34 100644
--- a/libcxx/test/std/containers/associative/multiset/equal_range.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/equal_range.pass.cpp
@@ -10,8 +10,8 @@
// class multiset
-// pair<iterator,iterator> equal_range(const key_type& k);
-// pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
+// pair<iterator,iterator> equal_range(const key_type& k); // constexpr since C++26
+// pair<const_iterator,const_iterator> equal_range(const key_type& k) const; // constexpr since C++26
#include <set>
#include <cassert>
@@ -20,7 +20,7 @@
#include "min_allocator.h"
#include "private_constructor.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef int V;
typedef std::multiset<int> M;
@@ -205,5 +205,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/equal_range_transparent.pass.cpp b/libcxx/test/std/containers/associative/multiset/equal_range_transparent.pass.cpp
index 6402488a44f22..385b05c8f26b1 100644
--- a/libcxx/test/std/containers/associative/multiset/equal_range_transparent.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/equal_range_transparent.pass.cpp
@@ -14,26 +14,30 @@
// template<typename K>
// pair<iterator,iterator> equal_range(const K& x); //
-// C++14
+// C++14, constexpr since C++26
// template<typename K>
// pair<const_iterator,const_iterator> equal_range(const K& x) const; //
-// C++14
+// C++14, constexpr since C++26
#include <cassert>
#include <set>
#include <utility>
+#include "test_macros.h"
+
struct Comp {
using is_transparent = void;
- bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const { return lhs < rhs; }
+ TEST_CONSTEXPR_CXX26 bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const {
+ return lhs < rhs;
+ }
- bool operator()(const std::pair<int, int>& lhs, int rhs) const { return lhs.first < rhs; }
+ TEST_CONSTEXPR_CXX26 bool operator()(const std::pair<int, int>& lhs, int rhs) const { return lhs.first < rhs; }
- bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
+ TEST_CONSTEXPR_CXX26 bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
std::multiset<std::pair<int, int>, Comp> s{{2, 1}, {1, 1}, {1, 1}, {1, 1}, {2, 2}};
auto er = s.equal_range(1);
@@ -46,5 +50,13 @@ int main(int, char**) {
assert(nels == 3);
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/erase_iter.pass.cpp b/libcxx/test/std/containers/associative/multiset/erase_iter.pass.cpp
index 31f00feda2977..a7da30fcd2a96 100644
--- a/libcxx/test/std/containers/associative/multiset/erase_iter.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/erase_iter.pass.cpp
@@ -10,7 +10,7 @@
// class multiset
-// iterator erase(const_iterator position);
+// iterator erase(const_iterator position); // constexpr since C++26
#include <set>
#include <cassert>
@@ -20,12 +20,12 @@
struct TemplateConstructor {
template <typename T>
- TemplateConstructor(const T&) {}
+ TEST_CONSTEXPR_CXX26 TemplateConstructor(const T&) {}
};
-bool operator<(const TemplateConstructor&, const TemplateConstructor&) { return false; }
+TEST_CONSTEXPR_CXX26 bool operator<(const TemplateConstructor&, const TemplateConstructor&) { return false; }
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::multiset<int> M;
typedef int V;
@@ -179,5 +179,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/erase_iter_iter.pass.cpp b/libcxx/test/std/containers/associative/multiset/erase_iter_iter.pass.cpp
index a3937d13bbb4b..942b076c702ea 100644
--- a/libcxx/test/std/containers/associative/multiset/erase_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/erase_iter_iter.pass.cpp
@@ -10,7 +10,7 @@
// class multiset
-// iterator erase(const_iterator first, const_iterator last);
+// iterator erase(const_iterator first, const_iterator last); // constexpr since C++26
#include <set>
#include <cassert>
@@ -18,7 +18,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::multiset<int> M;
typedef int V;
@@ -118,5 +118,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/erase_key.pass.cpp b/libcxx/test/std/containers/associative/multiset/erase_key.pass.cpp
index ba04a238e44b5..c6fe8f0563370 100644
--- a/libcxx/test/std/containers/associative/multiset/erase_key.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/erase_key.pass.cpp
@@ -10,7 +10,7 @@
// class multiset
-// size_type erase(const key_type& k);
+// size_type erase(const key_type& k); // constexpr since C++26
#include <set>
#include <cassert>
@@ -18,7 +18,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::multiset<int> M;
typedef int V;
@@ -104,5 +104,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/extract_iterator.pass.cpp b/libcxx/test/std/containers/associative/multiset/extract_iterator.pass.cpp
index 7f32fa82c46ab..c07a0d246fcf7 100644
--- a/libcxx/test/std/containers/associative/multiset/extract_iterator.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/extract_iterator.pass.cpp
@@ -12,7 +12,7 @@
// class multiset
-// node_type extract(const_iterator);
+// node_type extract(const_iterator); // constexpr since C++26
#include <set>
#include "test_macros.h"
@@ -20,7 +20,7 @@
#include "Counter.h"
template <class Container>
-void test(Container& c) {
+TEST_CONSTEXPR_CXX26 void test(Container& c) {
std::size_t sz = c.size();
for (auto first = c.cbegin(); first != c.cend();) {
@@ -35,14 +35,14 @@ void test(Container& c) {
assert(c.size() == 0);
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
using set_type = std::multiset<int>;
set_type m = {1, 2, 3, 4, 5, 6};
test(m);
}
- {
+ if (!TEST_IS_CONSTANT_EVALUATED) {
std::multiset<Counter<int>> m = {1, 2, 3, 4, 5, 6};
assert(Counter_base::gConstructed == 6);
test(m);
@@ -55,5 +55,13 @@ int main(int, char**) {
test(m);
}
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/extract_key.pass.cpp b/libcxx/test/std/containers/associative/multiset/extract_key.pass.cpp
index ec75a6c5d835c..52adc8ade796c 100644
--- a/libcxx/test/std/containers/associative/multiset/extract_key.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/extract_key.pass.cpp
@@ -12,7 +12,7 @@
// class multiset
-// node_type extract(key_type const&);
+// node_type extract(key_type const&); // constexpr since C++26
#include <set>
#include "test_macros.h"
@@ -20,7 +20,7 @@
#include "Counter.h"
template <class Container, class KeyTypeIter>
-void test(Container& c, KeyTypeIter first, KeyTypeIter last) {
+TEST_CONSTEXPR_CXX26 void test(Container& c, KeyTypeIter first, KeyTypeIter last) {
std::size_t sz = c.size();
assert((std::size_t)std::distance(first, last) == sz);
@@ -41,7 +41,7 @@ void test(Container& c, KeyTypeIter first, KeyTypeIter last) {
}
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
std::multiset<int> m = {1, 2, 3, 4, 5, 6};
int keys[] = {1, 2, 3, 4, 5, 6};
@@ -61,7 +61,7 @@ int main(int, char**) {
assert(!res);
}
- {
+ if (!TEST_IS_CONSTANT_EVALUATED) {
std::multiset<Counter<int>> m = {1, 2, 3, 4, 5, 6};
{
Counter<int> keys[] = {1, 2, 3, 4, 5, 6};
@@ -78,5 +78,13 @@ int main(int, char**) {
test(m, std::begin(keys), std::end(keys));
}
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/find.pass.cpp b/libcxx/test/std/containers/associative/multiset/find.pass.cpp
index 866de0da5ea93..bb5be9a28502b 100644
--- a/libcxx/test/std/containers/associative/multiset/find.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/find.pass.cpp
@@ -10,8 +10,8 @@
// class multiset
-// iterator find(const key_type& k);
-// const_iterator find(const key_type& k) const;
+// iterator find(const key_type& k); // constexpr since C++26
+// const_iterator find(const key_type& k) const; // constexpr since C++26
#include <set>
#include <cassert>
@@ -20,7 +20,7 @@
#include "min_allocator.h"
#include "private_constructor.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef int V;
typedef std::multiset<int> M;
@@ -202,5 +202,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/get_allocator.pass.cpp b/libcxx/test/std/containers/associative/multiset/get_allocator.pass.cpp
index 55bbd567d4360..3def31b6e0c84 100644
--- a/libcxx/test/std/containers/associative/multiset/get_allocator.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/get_allocator.pass.cpp
@@ -10,7 +10,7 @@
// class multiset
-// allocator_type get_allocator() const
+// allocator_type get_allocator() const; // constexpr since C++26
#include <set>
#include <cassert>
@@ -18,7 +18,7 @@
#include "test_allocator.h"
#include "test_macros.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
std::allocator<int> alloc;
const std::multiset<int> s(alloc);
@@ -29,5 +29,13 @@ int main(int, char**) {
const std::multiset<int, std::less<int>, other_allocator<int> > s(alloc);
assert(s.get_allocator() == alloc);
}
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/incomplete_type.pass.cpp b/libcxx/test/std/containers/associative/multiset/incomplete_type.pass.cpp
index 31cb96ec33e76..63fd68a747c32 100644
--- a/libcxx/test/std/containers/associative/multiset/incomplete_type.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/incomplete_type.pass.cpp
@@ -23,10 +23,18 @@ struct A {
Set::const_iterator cit;
};
-inline bool operator==(A const& L, A const& R) { return &L == &R; }
-inline bool operator<(A const& L, A const& R) { return L.data < R.data; }
-int main(int, char**) {
+inline TEST_CONSTEXPR_CXX26 bool operator==(A const& L, A const& R) { return &L == &R; }
+inline TEST_CONSTEXPR_CXX26 bool operator<(A const& L, A const& R) { return L.data < R.data; }
+TEST_CONSTEXPR_CXX26 bool test() {
A a;
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/insert_cv.pass.cpp b/libcxx/test/std/containers/associative/multiset/insert_cv.pass.cpp
index 237cf9bb6fac2..556f29496dda2 100644
--- a/libcxx/test/std/containers/associative/multiset/insert_cv.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/insert_cv.pass.cpp
@@ -10,7 +10,7 @@
// class multiset
-// iterator insert(const value_type& v);
+// iterator insert(const value_type& v); // constexpr since C++26
#include <set>
#include <cassert>
@@ -19,7 +19,7 @@
#include "min_allocator.h"
template <class Container>
-void do_insert_cv_test() {
+TEST_CONSTEXPR_CXX26 void do_insert_cv_test() {
typedef Container M;
typedef typename M::iterator R;
typedef typename M::value_type VT;
@@ -48,7 +48,7 @@ void do_insert_cv_test() {
assert(*r == 3);
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
do_insert_cv_test<std::multiset<int> >();
#if TEST_STD_VER >= 11
{
@@ -57,5 +57,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp b/libcxx/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp
index 8f4f165252d36..b561b5864c771 100644
--- a/libcxx/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/insert_initializer_list.pass.cpp
@@ -12,7 +12,7 @@
// class multiset
-// void insert(initializer_list<value_type> il);
+// void insert(initializer_list<value_type> il); // constexpr since C++26
#include <set>
#include <cassert>
@@ -21,7 +21,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::multiset<int> C;
typedef C::value_type V;
@@ -57,5 +57,13 @@ int main(int, char**) {
assert(*++i == V(10));
}
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/insert_iter_cv.pass.cpp b/libcxx/test/std/containers/associative/multiset/insert_iter_cv.pass.cpp
index 97c03be6cc57b..eb63f2f838891 100644
--- a/libcxx/test/std/containers/associative/multiset/insert_iter_cv.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/insert_iter_cv.pass.cpp
@@ -10,7 +10,7 @@
// class multiset
-// iterator insert(const_iterator position, const value_type& v);
+// iterator insert(const_iterator position, const value_type& v); // constexpr since C++26
#include <set>
#include <cassert>
@@ -18,7 +18,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::multiset<int> M;
typedef M::iterator R;
@@ -70,5 +70,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/insert_iter_iter.pass.cpp b/libcxx/test/std/containers/associative/multiset/insert_iter_iter.pass.cpp
index 56483714cd50c..858ca520a304a 100644
--- a/libcxx/test/std/containers/associative/multiset/insert_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/insert_iter_iter.pass.cpp
@@ -21,7 +21,7 @@
#include "test_iterators.h"
template <class Iter, class Alloc>
-void test_alloc() {
+TEST_CONSTEXPR_CXX26 void test_alloc() {
{ // Check that an empty range works correctly
{ // Without elements in the container
using Map = std::multiset<int, std::less<int>, Alloc>;
@@ -184,13 +184,17 @@ void test_alloc() {
}
}
-void test() {
+TEST_CONSTEXPR_CXX26 bool test() {
test_alloc<cpp17_input_iterator<int*>, std::allocator<int> >();
test_alloc<cpp17_input_iterator<int*>, min_allocator<int> >();
+ return true;
}
int main(int, char**) {
test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp b/libcxx/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp
index d01f6b9b2c306..874e560f6a533 100644
--- a/libcxx/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/insert_iter_rv.pass.cpp
@@ -12,7 +12,7 @@
// class multiset
-// iterator insert(const_iterator position, value_type&& v);
+// iterator insert(const_iterator position, value_type&& v); // constexpr since C++26
#include <set>
#include <cassert>
@@ -21,7 +21,7 @@
#include "MoveOnly.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::multiset<MoveOnly> M;
typedef M::iterator R;
@@ -71,5 +71,13 @@ int main(int, char**) {
assert(*r == 3);
}
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/insert_node_type.pass.cpp b/libcxx/test/std/containers/associative/multiset/insert_node_type.pass.cpp
index 6971d6b6e5eae..4a20c2792c76e 100644
--- a/libcxx/test/std/containers/associative/multiset/insert_node_type.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/insert_node_type.pass.cpp
@@ -12,7 +12,7 @@
// class multiset
-// iterator insert(node_type&&);
+// iterator insert(node_type&&); // constexpr since C++26
#include <set>
#include <type_traits>
@@ -20,18 +20,18 @@
#include "min_allocator.h"
template <class Container>
-typename Container::node_type node_factory(typename Container::key_type const& key) {
- static Container c;
+TEST_CONSTEXPR_CXX26 typename Container::node_type node_factory(Container& c, typename Container::key_type const& key) {
auto it = c.insert(key);
return c.extract(it);
}
template <class Container>
-void test(Container& c) {
+TEST_CONSTEXPR_CXX26 void test(Container& c) {
auto* nf = &node_factory<Container>;
+ Container c2;
for (int i = 0; i != 10; ++i) {
- typename Container::node_type node = nf(i);
+ typename Container::node_type node = nf(c, i);
assert(!node.empty());
typename Container::iterator it = c.insert(std::move(node));
assert(node.empty());
@@ -50,7 +50,7 @@ void test(Container& c) {
}
{ // Insert duplicate node.
- typename Container::node_type dupl = nf(0);
+ typename Container::node_type dupl = nf(c2, 0);
auto it = c.insert(std::move(dupl));
assert(*it == 0);
}
@@ -63,11 +63,19 @@ void test(Container& c) {
}
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
std::multiset<int> m;
test(m);
std::multiset<int, std::less<int>, min_allocator<int>> m2;
test(m2);
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/insert_node_type_hint.pass.cpp b/libcxx/test/std/containers/associative/multiset/insert_node_type_hint.pass.cpp
index b0392088beb6b..b5c2aae45f01f 100644
--- a/libcxx/test/std/containers/associative/multiset/insert_node_type_hint.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/insert_node_type_hint.pass.cpp
@@ -12,25 +12,26 @@
// class multiset
-// iterator insert(const_iterator hint, node_type&&);
+// iterator insert(const_iterator hint, node_type&&); // constexpr since C++26
#include <set>
#include "test_macros.h"
#include "min_allocator.h"
template <class Container>
-typename Container::node_type node_factory(typename Container::key_type const& key) {
- static Container c;
+TEST_CONSTEXPR_CXX26 typename Container::node_type node_factory(Container& c, typename Container::key_type const& key) {
auto it = c.insert(key);
return c.extract(it);
}
template <class Container>
-void test(Container& c) {
+TEST_CONSTEXPR_CXX26 void test(Container& c) {
auto* nf = &node_factory<Container>;
+ Container c2;
+
for (int i = 0; i != 10; ++i) {
- typename Container::node_type node = nf(i);
+ typename Container::node_type node = nf(c2, i);
assert(!node.empty());
std::size_t prev = c.size();
auto it = c.insert(c.end(), std::move(node));
@@ -45,11 +46,19 @@ void test(Container& c) {
}
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
std::multiset<int> m;
test(m);
std::multiset<int, std::less<int>, min_allocator<int>> m2;
test(m2);
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/insert_range.pass.cpp b/libcxx/test/std/containers/associative/multiset/insert_range.pass.cpp
index d57e14f4b59c8..55edbfd8af079 100644
--- a/libcxx/test/std/containers/associative/multiset/insert_range.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/insert_range.pass.cpp
@@ -9,18 +9,19 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// Some fields in the test case variables are deliberately not explicitly initialized, this silences a warning on GCC.
// ADDITIONAL_COMPILE_FLAGS(gcc-style-warnings): -Wno-missing-field-initializers
+// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=4000000
// <set>
// template<container-compatible-range<value_type> R>
-// void insert_range(R&& rg); // C++23
+// void insert_range(R&& rg); // C++23, constexpr since C++26
#include <set>
#include "../../insert_range_maps_sets.h"
#include "test_macros.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
for_all_iterators_and_allocators<int, const int*>([]<class Iter, class Sent, class Alloc>() {
test_map_set_insert_range<std::multiset<int, test_less<int>, Alloc>, int, Iter, Sent>(/*allow_duplicates=*/true);
});
@@ -32,5 +33,13 @@ int main(int, char**) {
test_set_insert_range_exception_safety_throwing_copy<std::multiset>();
test_assoc_set_insert_range_exception_safety_throwing_allocator<std::multiset, int>();
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/insert_rv.pass.cpp b/libcxx/test/std/containers/associative/multiset/insert_rv.pass.cpp
index 88155572f1680..387a99c042f7d 100644
--- a/libcxx/test/std/containers/associative/multiset/insert_rv.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/insert_rv.pass.cpp
@@ -12,7 +12,7 @@
// class multiset
-// iterator insert(value_type&& v);
+// iterator insert(value_type&& v); // constexpr since C++26
#include <set>
#include <cassert>
@@ -21,7 +21,7 @@
#include "MoveOnly.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::multiset<MoveOnly> M;
typedef M::iterator R;
@@ -71,5 +71,13 @@ int main(int, char**) {
assert(*r == 3);
}
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/iterator.pass.cpp b/libcxx/test/std/containers/associative/multiset/iterator.pass.cpp
index fee8bf9d3eb30..542ba871960ee 100644
--- a/libcxx/test/std/containers/associative/multiset/iterator.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/iterator.pass.cpp
@@ -10,20 +10,20 @@
// class multiset
-// iterator begin();
-// const_iterator begin() const;
-// iterator end();
-// const_iterator end() const;
+// iterator begin(); // constexpr since C++26
+// const_iterator begin() const; // constexpr since C++26
+// iterator end(); // constexpr since C++26
+// const_iterator end() const; // constexpr since C++26
//
-// reverse_iterator rbegin();
-// const_reverse_iterator rbegin() const;
-// reverse_iterator rend();
-// const_reverse_iterator rend() const;
+// reverse_iterator rbegin(); // constexpr since C++26
+// const_reverse_iterator rbegin() const; // constexpr since C++26
+// reverse_iterator rend(); // constexpr since C++26
+// const_reverse_iterator rend() const; // constexpr since C++26
//
-// const_iterator cbegin() const;
-// const_iterator cend() const;
-// const_reverse_iterator crbegin() const;
-// const_reverse_iterator crend() const;
+// const_iterator cbegin() const; // constexpr since C++26
+// const_iterator cend() const; // constexpr since C++26
+// const_reverse_iterator crbegin() const; // constexpr since C++26
+// const_reverse_iterator crend() const; // constexpr since C++26
#include <set>
#include <cassert>
@@ -32,7 +32,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef int V;
V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8};
@@ -137,5 +137,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/lower_bound.pass.cpp b/libcxx/test/std/containers/associative/multiset/lower_bound.pass.cpp
index ddd39d8fc0348..c2883e039c8a9 100644
--- a/libcxx/test/std/containers/associative/multiset/lower_bound.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/lower_bound.pass.cpp
@@ -10,8 +10,8 @@
// class multiset
-// iterator lower_bound(const key_type& k);
-// const_iterator lower_bound(const key_type& k) const;
+// iterator lower_bound(const key_type& k); // constexpr since C++26
+// const_iterator lower_bound(const key_type& k) const; // constexpr since C++26
#include <set>
#include <cassert>
@@ -20,7 +20,7 @@
#include "min_allocator.h"
#include "private_constructor.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef int V;
typedef std::multiset<int> M;
@@ -165,5 +165,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/max_size.pass.cpp b/libcxx/test/std/containers/associative/multiset/max_size.pass.cpp
index a6cff58b090bd..b7b6d28d002ac 100644
--- a/libcxx/test/std/containers/associative/multiset/max_size.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/max_size.pass.cpp
@@ -10,7 +10,7 @@
// class multiset
-// size_type max_size() const;
+// size_type max_size() const; // constexpr since C++26
#include <cassert>
#include <limits>
@@ -20,7 +20,7 @@
#include "test_allocator.h"
#include "test_macros.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef limited_allocator<int, 10> A;
typedef std::multiset<int, std::less<int>, A> C;
@@ -44,5 +44,13 @@ int main(int, char**) {
assert(c.max_size() <= alloc_max_size(c.get_allocator()));
}
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/merge.pass.cpp b/libcxx/test/std/containers/associative/multiset/merge.pass.cpp
index 90eaeb2adbfcb..0397f16c52d41 100644
--- a/libcxx/test/std/containers/associative/multiset/merge.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/merge.pass.cpp
@@ -13,13 +13,13 @@
// class multiset
// template <class C2>
-// void merge(set<Key, C2, Allocator>& source);
+// void merge(set<Key, C2, Allocator>& source); // constexpr since C++26
// template <class C2>
-// void merge(set<Key, C2, Allocator>&& source);
+// void merge(set<Key, C2, Allocator>&& source); // constexpr since C++26
// template <class C2>
-// void merge(multiset<Key, C2, Allocator>& source);
+// void merge(multiset<Key, C2, Allocator>& source); // constexpr since C++26
// template <class C2>
-// void merge(multiset<Key, C2, Allocator>&& source);
+// void merge(multiset<Key, C2, Allocator>&& source); // constexpr since C++26
#include <set>
#include <cassert>
@@ -27,7 +27,7 @@
#include "Counter.h"
template <class Set>
-bool set_equal(const Set& set, Set other) {
+TEST_CONSTEXPR_CXX26 bool set_equal(const Set& set, Set other) {
return set == other;
}
@@ -35,10 +35,10 @@ bool set_equal(const Set& set, Set other) {
struct throw_comparator {
bool& should_throw_;
- throw_comparator(bool& should_throw) : should_throw_(should_throw) {}
+ TEST_CONSTEXPR_CXX26 throw_comparator(bool& should_throw) : should_throw_(should_throw) {}
template <class T>
- bool operator()(const T& lhs, const T& rhs) const {
+ TEST_CONSTEXPR_CXX26 bool operator()(const T& lhs, const T& rhs) const {
if (should_throw_)
throw 0;
return lhs < rhs;
@@ -46,7 +46,7 @@ struct throw_comparator {
};
#endif
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
std::multiset<int> src{1, 3, 5};
std::multiset<int> dst{2, 4, 5};
@@ -56,7 +56,8 @@ int main(int, char**) {
}
#ifndef TEST_HAS_NO_EXCEPTIONS
- {
+
+ if (!TEST_IS_CONSTANT_EVALUATED) {
bool do_throw = false;
typedef std::multiset<Counter<int>, throw_comparator> set_type;
set_type src({1, 3, 5}, throw_comparator(do_throw));
@@ -75,13 +76,15 @@ int main(int, char**) {
assert(set_equal(dst, set_type({2, 4, 5}, throw_comparator(do_throw))));
}
#endif
- assert(Counter_base::gConstructed == 0);
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ assert(Counter_base::gConstructed == 0);
+ }
struct comparator {
comparator() = default;
bool operator()(const Counter<int>& lhs, const Counter<int>& rhs) const { return lhs < rhs; }
};
- {
+ if (!TEST_IS_CONSTANT_EVALUATED) {
typedef std::multiset<Counter<int>, std::less<Counter<int>>> first_set_type;
typedef std::multiset<Counter<int>, comparator> second_set_type;
typedef std::set<Counter<int>, comparator> third_set_type;
@@ -134,5 +137,13 @@ int main(int, char**) {
first.merge(std::move(second));
}
}
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/alloc.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/alloc.pass.cpp
index 1f05201d706b1..fafcf50fa15ad 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/alloc.pass.cpp
@@ -10,7 +10,7 @@
// class multiset
-// multiset(const allocator_type& a);
+// multiset(const allocator_type& a); // constexpr since C++26
#include <set>
#include <cassert>
@@ -18,7 +18,7 @@
#include "test_macros.h"
#include "test_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
typedef std::less<int> C;
typedef test_allocator<int> A;
std::multiset<int, C, A> m(A(5));
@@ -26,5 +26,13 @@ int main(int, char**) {
assert(m.begin() == m.end());
assert(m.get_allocator() == A(5));
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp
index 7234e61d28bfa..914c07ed9d6f7 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/assign_initializer_list.pass.cpp
@@ -12,7 +12,7 @@
// class multiset
-// multiset& operator=(initializer_list<value_type> il);
+// multiset& operator=(initializer_list<value_type> il); // constexpr since C++26
#include <set>
#include <cassert>
@@ -20,7 +20,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::multiset<int> C;
typedef C::value_type V;
@@ -52,5 +52,13 @@ int main(int, char**) {
assert(*++i == V(6));
}
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/compare.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/compare.pass.cpp
index b7da7f66b020d..635b5999dbcd7 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/compare.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/compare.pass.cpp
@@ -10,7 +10,7 @@
// class multiset
-// explicit multiset(const key_compare& comp);
+// explicit multiset(const key_compare& comp); // constexpr since C++26
#include <set>
#include <cassert>
@@ -18,7 +18,7 @@
#include "test_macros.h"
#include "../../../test_compare.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
typedef test_less<int> C;
const std::multiset<int, C> m(C(3));
assert(m.empty());
@@ -26,5 +26,13 @@ int main(int, char**) {
assert(m.key_comp() == C(3));
assert(m.value_comp() == C(3));
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/compare_alloc.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/compare_alloc.pass.cpp
index be8a451fdc405..e8138c0501263 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/compare_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/compare_alloc.pass.cpp
@@ -10,7 +10,7 @@
// class multiset
-// multiset(const value_compare& comp, const allocator_type& a);
+// multiset(const value_compare& comp, const allocator_type& a); // constexpr since C++26
#include <set>
#include <cassert>
@@ -19,7 +19,7 @@
#include "../../../test_compare.h"
#include "test_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
typedef test_less<int> C;
typedef test_allocator<int> A;
std::multiset<int, C, A> m(C(4), A(5));
@@ -28,5 +28,13 @@ int main(int, char**) {
assert(m.key_comp() == C(4));
assert(m.get_allocator() == A(5));
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/copy.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/copy.pass.cpp
index c747828aa01cc..7d56ea93a9a45 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/copy.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/copy.pass.cpp
@@ -10,7 +10,7 @@
// class multiset
-// multiset(const multiset& m);
+// multiset(const multiset& m); // constexpr since C++26
#include <set>
#include <cassert>
@@ -22,7 +22,7 @@
#include "test_allocator.h"
template <template <class> class Alloc>
-void test_alloc() {
+TEST_CONSTEXPR_CXX26 void test_alloc() {
{ // Simple check
using Set = std::multiset<int, std::less<int>, Alloc<int> >;
@@ -81,7 +81,7 @@ void test_alloc() {
}
}
-void test() {
+TEST_CONSTEXPR_CXX26 bool test() {
test_alloc<std::allocator>();
test_alloc<min_allocator>(); // Make sure that fancy pointers work
@@ -127,10 +127,14 @@ void test() {
assert(orig.size() == 3);
assert(orig.get_allocator() == other_allocator<int>(10));
}
+
+ return true;
}
int main(int, char**) {
test();
-
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/copy_alloc.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/copy_alloc.pass.cpp
index 868072ef15288..f79ae3713540b 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/copy_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/copy_alloc.pass.cpp
@@ -10,7 +10,7 @@
// class multiset
-// multiset(const multiset& m, const allocator_type& a);
+// multiset(const multiset& m, const allocator_type& a); // constexpr since C++26
#include <set>
#include <cassert>
@@ -22,7 +22,7 @@
#include "test_allocator.h"
template <class Alloc>
-void test_alloc(const Alloc& new_alloc) {
+TEST_CONSTEXPR_CXX26 void test_alloc(const Alloc& new_alloc) {
{ // Simple check
using Set = std::multiset<int, std::less<int>, Alloc>;
@@ -82,7 +82,7 @@ void test_alloc(const Alloc& new_alloc) {
}
}
-void test() {
+TEST_CONSTEXPR_CXX26 bool test() {
test_alloc(std::allocator<int>());
test_alloc(test_allocator<int>(25)); // Make sure that the new allocator is actually used
test_alloc(min_allocator<int>()); // Make sure that fancy pointers work
@@ -98,10 +98,14 @@ void test() {
assert(orig.size() == 3);
assert(orig.key_comp() == test_less<int>(3));
}
+
+ return true;
}
int main(int, char**) {
test();
-
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/copy_assign.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/copy_assign.pass.cpp
index 0a5fe62eed69e..86b86f92f3338 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/copy_assign.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/copy_assign.pass.cpp
@@ -10,7 +10,7 @@
// class multiset
-// multiset& operator=(const multiset& s);
+// multiset& operator=(const multiset& s); // constexpr since C++26
#include <algorithm>
#include <cassert>
@@ -33,41 +33,42 @@ class tracking_allocator {
using value_type = T;
using propagate_on_container_copy_assignment = std::true_type;
- tracking_allocator(std::vector<void*>& allocs) : allocs_(&allocs) {}
+ TEST_CONSTEXPR_CXX26 tracking_allocator(std::vector<void*>& allocs) : allocs_(&allocs) {}
template <class U>
- tracking_allocator(const tracking_allocator<U>& other) : allocs_(other.allocs_) {}
+ TEST_CONSTEXPR_CXX26 tracking_allocator(const tracking_allocator<U>& other) : allocs_(other.allocs_) {}
- T* allocate(std::size_t n) {
+ TEST_CONSTEXPR_CXX26 T* allocate(std::size_t n) {
T* allocation = std::allocator<T>().allocate(n);
allocs_->push_back(allocation);
return allocation;
}
- void deallocate(T* ptr, std::size_t n) TEST_NOEXCEPT {
+ TEST_CONSTEXPR_CXX26 void deallocate(T* ptr, std::size_t n) TEST_NOEXCEPT {
auto res = std::remove(allocs_->begin(), allocs_->end(), ptr);
assert(res != allocs_->end() && "Trying to deallocate memory from
diff erent allocator?");
allocs_->erase(res);
std::allocator<T>().deallocate(ptr, n);
}
- friend bool operator==(const tracking_allocator& lhs, const tracking_allocator& rhs) {
+ friend TEST_CONSTEXPR_CXX26 bool operator==(const tracking_allocator& lhs, const tracking_allocator& rhs) {
return lhs.allocs_ == rhs.allocs_;
}
- friend bool operator!=(const tracking_allocator& lhs, const tracking_allocator& rhs) {
+ friend TEST_CONSTEXPR_CXX26 bool operator!=(const tracking_allocator& lhs, const tracking_allocator& rhs) {
return lhs.allocs_ != rhs.allocs_;
}
};
struct NoOp {
- void operator()() {}
+ TEST_CONSTEXPR_CXX26 void operator()() {}
};
template <class Alloc, class AllocatorInvariant = NoOp>
-void test_alloc(const Alloc& lhs_alloc = Alloc(),
- const Alloc& rhs_alloc = Alloc(),
- AllocatorInvariant check_alloc_invariant = NoOp()) {
+TEST_CONSTEXPR_CXX26 void
+test_alloc(const Alloc& lhs_alloc = Alloc(),
+ const Alloc& rhs_alloc = Alloc(),
+ AllocatorInvariant check_alloc_invariant = NoOp()) {
{ // Test empty/non-empty multiset combinations
{ // assign from a non-empty container into an empty one
using Set = std::multiset<int, std::less<int>, Alloc>;
@@ -234,7 +235,7 @@ void test_alloc(const Alloc& lhs_alloc = Alloc(),
}
}
-void test() {
+TEST_CONSTEXPR_CXX26 bool test() {
test_alloc<std::allocator<int> >();
#if TEST_STD_VER >= 11
test_alloc<min_allocator<int> >();
@@ -246,10 +247,10 @@ void test() {
std::vector<void*>* rhs_allocs_;
public:
- AssertEmpty(std::vector<void*>& lhs_allocs, std::vector<void*>& rhs_allocs)
+ TEST_CONSTEXPR_CXX26 AssertEmpty(std::vector<void*>& lhs_allocs, std::vector<void*>& rhs_allocs)
: lhs_allocs_(&lhs_allocs), rhs_allocs_(&rhs_allocs) {}
- void operator()() {
+ TEST_CONSTEXPR_CXX26 void operator()() {
assert(lhs_allocs_->empty());
assert(rhs_allocs_->empty());
}
@@ -273,10 +274,14 @@ void test() {
assert(orig.size() == 3);
assert(orig.key_comp() == test_less<int>(3));
}
+
+ return true;
}
int main(int, char**) {
test();
-
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/deduct.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/deduct.pass.cpp
index f9797ca571c47..7a2cc45ae9cdc 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/deduct.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/deduct.pass.cpp
@@ -49,10 +49,10 @@
#include "test_allocator.h"
struct NotAnAllocator {
- friend bool operator<(NotAnAllocator, NotAnAllocator) { return false; }
+ friend TEST_CONSTEXPR_CXX26 bool operator<(NotAnAllocator, NotAnAllocator) { return false; }
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
const int arr[] = {1, 2, 1, INT_MAX, 3};
std::multiset s(std::begin(arr), std::end(arr));
@@ -212,5 +212,13 @@ int main(int, char**) {
AssociativeContainerDeductionGuidesSfinaeAway<std::multiset, std::multiset<int>>();
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/default.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/default.pass.cpp
index 4f7dabfea2c68..256b6f41dc3db 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/default.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/default.pass.cpp
@@ -10,7 +10,7 @@
// class multiset
-// multiset();
+// multiset(); // constexpr since C++26
#include <set>
#include <cassert>
@@ -18,7 +18,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
std::multiset<int> m;
assert(m.empty());
@@ -51,5 +51,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp
index 052b032d6e798..532a98066e51a 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/default_noexcept.pass.cpp
@@ -12,7 +12,7 @@
// noexcept(
// is_nothrow_default_constructible<allocator_type>::value &&
// is_nothrow_default_constructible<key_compare>::value &&
-// is_nothrow_copy_constructible<key_compare>::value);
+// is_nothrow_copy_constructible<key_compare>::value); // constexpr since C++26
// This tests a conforming extension
@@ -32,7 +32,7 @@ struct some_comp {
bool operator()(const T&, const T&) const { return false; }
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
#if defined(_LIBCPP_VERSION)
{
typedef std::multiset<MoveOnly> C;
@@ -52,5 +52,13 @@ int main(int, char**) {
static_assert(!std::is_nothrow_default_constructible<C>::value, "");
}
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp
index bf5d256e19a0f..2f81f954c8757 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/dtor_noexcept.pass.cpp
@@ -8,7 +8,7 @@
// <set>
-// ~multiset() // implied noexcept;
+// ~multiset() // implied noexcept; // constexpr since C++26
// UNSUPPORTED: c++03
@@ -27,7 +27,7 @@ struct some_comp {
bool operator()(const T&, const T&) const { return false; }
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::multiset<MoveOnly> C;
static_assert(std::is_nothrow_destructible<C>::value, "");
@@ -47,5 +47,13 @@ int main(int, char**) {
}
#endif // _LIBCPP_VERSION
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/from_range.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/from_range.pass.cpp
index 15275781a8aac..ca1d7c20869b9 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/from_range.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/from_range.pass.cpp
@@ -7,13 +7,14 @@
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=2000000
// template<container-compatible-range<value_type> R>
-// multiset(from_range_t, R&& rg, const Compare& comp = Compare(), const Allocator& = Allocator()); // C++23
+// multiset(from_range_t, R&& rg, const Compare& comp = Compare(), const Allocator& = Allocator()); // C++23, constexpr since C++26
//
// template<container-compatible-range<value_type> R>
// multiset(from_range_t, R&& rg, const Allocator& a))
-// : multiset(from_range, std::forward<R>(rg), Compare(), a) { } // C++23
+// : multiset(from_range, std::forward<R>(rg), Compare(), a) { } // C++23, constexpr since C++26
#include <algorithm>
#include <array>
@@ -22,13 +23,13 @@
#include "../../from_range_associative_containers.h"
#include "test_macros.h"
-void test_duplicates() {
+TEST_CONSTEXPR_CXX26 void test_duplicates() {
std::array input = {1, 2, 3, 3, 3, 4, 2, 1, 2};
auto c = std::multiset<int>(std::from_range, input);
assert(std::ranges::is_permutation(input, c));
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
for_all_iterators_and_allocators<int>([]<class Iter, class Sent, class Alloc>() {
test_associative_set<std::multiset, int, Iter, Sent, test_less<int>, Alloc>();
});
@@ -40,5 +41,13 @@ int main(int, char**) {
test_set_exception_safety_throwing_copy<std::multiset>();
test_set_exception_safety_throwing_allocator<std::multiset, int>();
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp
index c860f17bb4196..bde073eeee9d7 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list.pass.cpp
@@ -12,7 +12,7 @@
// class multiset
-// multiset(initializer_list<value_type> il, const key_compare& comp = key_compare());
+// multiset(initializer_list<value_type> il, const key_compare& comp = key_compare()); // constexpr since C++26
#include <set>
#include <cassert>
@@ -20,7 +20,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::multiset<int> C;
typedef C::value_type V;
@@ -66,5 +66,13 @@ int main(int, char**) {
assert(m.get_allocator() == a);
}
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare.pass.cpp
index 5bb400cb82be9..f144c05352f09 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare.pass.cpp
@@ -12,7 +12,7 @@
// class multiset
-// multiset(initializer_list<value_type> il, const key_compare& comp = key_compare());
+// multiset(initializer_list<value_type> il, const key_compare& comp = key_compare()); // constexpr since C++26
#include <set>
#include <cassert>
@@ -21,7 +21,7 @@
#include "test_macros.h"
#include "../../../test_compare.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
typedef test_less<int> Cmp;
typedef std::multiset<int, Cmp> C;
typedef C::value_type V;
@@ -37,5 +37,13 @@ int main(int, char**) {
assert(*++i == V(6));
assert(m.key_comp() == Cmp(10));
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare_alloc.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare_alloc.pass.cpp
index a12e68c1e582b..63d8199ea434e 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare_alloc.pass.cpp
@@ -12,7 +12,7 @@
// class multiset
-// multiset(initializer_list<value_type> il, const key_compare& comp, const allocator_type& a);
+// multiset(initializer_list<value_type> il, const key_compare& comp, const allocator_type& a); // constexpr since C++26
#include <set>
#include <cassert>
@@ -22,7 +22,7 @@
#include "../../../test_compare.h"
#include "test_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
typedef test_less<int> Cmp;
typedef test_allocator<int> A;
typedef std::multiset<int, Cmp, A> C;
@@ -40,5 +40,13 @@ int main(int, char**) {
assert(m.key_comp() == Cmp(10));
assert(m.get_allocator() == A(4));
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp
index 6b98ceb1c0df7..bb41b35870444 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/iter_iter.pass.cpp
@@ -11,7 +11,7 @@
// class multiset
// template <class InputIterator>
-// multiset(InputIterator first, InputIterator last);
+// multiset(InputIterator first, InputIterator last); // constexpr since C++26
#include <set>
#include <cassert>
@@ -20,7 +20,7 @@
#include "test_iterators.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef int V;
V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
@@ -58,5 +58,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
index 50f8fda2a676b..22ac9bd799e45 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/iter_iter_alloc.pass.cpp
@@ -12,7 +12,7 @@
// template <class InputIterator>
// multiset(InputIterator first, InputIterator last,
-// const value_compare& comp, const allocator_type& a);
+// const value_compare& comp, const allocator_type& a); // constexpr since C++26
#include <set>
#include <cassert>
@@ -23,7 +23,7 @@
#include "../../../test_compare.h"
#include "test_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef int V;
V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
@@ -72,5 +72,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/iter_iter_comp.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/iter_iter_comp.pass.cpp
index bed8d02f3e681..353f3bc84ad9f 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/iter_iter_comp.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/iter_iter_comp.pass.cpp
@@ -11,7 +11,7 @@
// class multiset
// template <class InputIterator>
-// multiset(InputIterator first, InputIterator last, const value_compare& comp);
+// multiset(InputIterator first, InputIterator last, const value_compare& comp); // constexpr since C++26
#include <cassert>
#include <set>
@@ -21,7 +21,7 @@
#include "test_iterators.h"
#include "../../../test_compare.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
typedef int V;
V ar[] = {1, 1, 1, 2, 2, 2, 3, 3, 3};
typedef test_less<V> C;
@@ -40,5 +40,13 @@ int main(int, char**) {
assert(*std::next(m.begin(), 7) == 3);
assert(*std::next(m.begin(), 8) == 3);
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp
index 2d71f21e182c9..a85823e464cbc 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/move.pass.cpp
@@ -12,7 +12,7 @@
// class multiset
-// multiset(multiset&& s);
+// multiset(multiset&& s); // constexpr since C++26
#include <set>
#include <cassert>
@@ -22,7 +22,7 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef int V;
typedef test_less<int> C;
@@ -94,5 +94,13 @@ int main(int, char**) {
assert(std::distance(mo.begin(), mo.end()) == 0);
}
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp
index 771a7038bf633..a3eaa419fbbab 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/move_alloc.pass.cpp
@@ -12,7 +12,7 @@
// class multiset
-// multiset(multiset&& s, const allocator_type& a);
+// multiset(multiset&& s, const allocator_type& a); // constexpr since C++26
#include <set>
#include <cassert>
@@ -24,7 +24,7 @@
#include "test_allocator.h"
#include "Counter.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef MoveOnly V;
typedef test_less<MoveOnly> C;
@@ -73,7 +73,7 @@ int main(int, char**) {
assert(m3.key_comp() == C(5));
LIBCPP_ASSERT(m1.empty());
}
- {
+ if (!TEST_IS_CONSTANT_EVALUATED) {
typedef Counter<int> V;
typedef std::less<V> C;
typedef test_allocator<V> A;
@@ -111,5 +111,13 @@ int main(int, char**) {
assert(Counter_base::gConstructed == 0);
}
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp
index 5cdd4ec67b8e0..60dc3a5bbc62f 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/move_assign.pass.cpp
@@ -12,7 +12,7 @@
// class multiset
-// multiset& operator=(multiset&& s);
+// multiset& operator=(multiset&& s); // constexpr since C++26
#include <set>
#include <cassert>
@@ -23,7 +23,7 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef MoveOnly V;
typedef test_less<MoveOnly> C;
@@ -93,5 +93,13 @@ int main(int, char**) {
assert(m1.empty());
}
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp
index 73b4be5005e1c..52519aaceab3f 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.cons/move_noexcept.pass.cpp
@@ -10,7 +10,7 @@
// multiset(multiset&&)
// noexcept(is_nothrow_move_constructible<allocator_type>::value &&
-// is_nothrow_move_constructible<key_compare>::value);
+// is_nothrow_move_constructible<key_compare>::value); // constexpr since C++26
// This tests a conforming extension
@@ -30,7 +30,7 @@ struct some_comp {
bool operator()(const T&, const T&) const { return false; }
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
#if defined(_LIBCPP_VERSION)
{
typedef std::multiset<MoveOnly> C;
@@ -50,5 +50,13 @@ int main(int, char**) {
static_assert(!std::is_nothrow_move_constructible<C>::value, "");
}
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.erasure/erase_if.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.erasure/erase_if.pass.cpp
index cfb304ee3be39..e0df9210c7da9 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.erasure/erase_if.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.erasure/erase_if.pass.cpp
@@ -11,7 +11,7 @@
// template <class T, class Compare, class Allocator, class Predicate>
// typename multiset<T, Compare, Allocator>::size_type
-// erase_if(multiset<T, Compare, Allocator>& c, Predicate pred);
+// erase_if(multiset<T, Compare, Allocator>& c, Predicate pred); // constexpr since C++26
#include <set>
@@ -20,14 +20,14 @@
#include "min_allocator.h"
template <class S, class Pred>
-void test0(S s, Pred p, S expected, std::size_t expected_erased_count) {
+TEST_CONSTEXPR_CXX26 void test0(S s, Pred p, S expected, std::size_t expected_erased_count) {
ASSERT_SAME_TYPE(typename S::size_type, decltype(std::erase_if(s, p)));
assert(expected_erased_count == std::erase_if(s, p));
assert(s == expected);
}
template <typename S>
-void test() {
+TEST_CONSTEXPR_CXX26 void test() {
auto is1 = [](auto v) { return v == 1; };
auto is2 = [](auto v) { return v == 2; };
auto is3 = [](auto v) { return v == 3; };
@@ -64,7 +64,7 @@ void test() {
test0(S({1, 2, 3}), False, S({1, 2, 3}), 0);
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
test<std::multiset<int>>();
test<std::multiset<int, std::less<int>, min_allocator<int>>>();
test<std::multiset<int, std::less<int>, test_allocator<int>>>();
@@ -72,5 +72,13 @@ int main(int, char**) {
test<std::multiset<long>>();
test<std::multiset<double>>();
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.nonmember/compare.three_way.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.nonmember/compare.three_way.pass.cpp
index fb575c880dd2e..ae3581104677c 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.nonmember/compare.three_way.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.nonmember/compare.three_way.pass.cpp
@@ -13,15 +13,22 @@
// template<class Key, class Compare, class Allocator>
// synth-three-way-result<Key> operator<=>(const multiset<Key, Compare, Allocator>& x,
-// const multiset<Key, Compare, Allocator>& y);
+// const multiset<Key, Compare, Allocator>& y); // constexpr since C++26
#include <cassert>
#include <set>
#include "test_container_comparisons.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
assert(test_ordered_set_container_spaceship<std::multiset>());
- // `std::multiset` is not constexpr, so no `static_assert` test here.
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.nonmember/op_compare.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.nonmember/op_compare.pass.cpp
index 9ffb5dc3593c5..1d5df25bebfdc 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.nonmember/op_compare.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.nonmember/op_compare.pass.cpp
@@ -38,7 +38,7 @@
#include "test_comparisons.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
std::multiset<int> s1, s2;
s1.insert(1);
@@ -70,5 +70,13 @@ int main(int, char**) {
const std::multiset<int>&cs1 = s1, cs2 = s2;
assert(testComparisons(cs1, cs2, false, true));
}
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.observers/comp.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.observers/comp.pass.cpp
index 63647a052c041..1908991e40eed 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.observers/comp.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.observers/comp.pass.cpp
@@ -8,13 +8,15 @@
// <set>
-// key_compare key_comp() const;
-// value_compare value_comp() const;
+// key_compare key_comp() const; // constexpr since C++26
+// value_compare value_comp() const; // constexpr since C++26
#include <set>
#include <cassert>
-int main(int, char**) {
+#include "test_macros.h"
+
+TEST_CONSTEXPR_CXX26 bool test() {
typedef std::multiset<int> set_type;
set_type s;
@@ -29,5 +31,13 @@ int main(int, char**) {
assert(cs.value_comp()(*i1, *i2));
assert(!cs.value_comp()(*i2, *i1));
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.special/member_swap.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.special/member_swap.pass.cpp
index af32e1882093d..997fe1d818b53 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.special/member_swap.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.special/member_swap.pass.cpp
@@ -10,7 +10,7 @@
// class multiset
-// void swap(multiset& m);
+// void swap(multiset& m); // constexpr since C++26
#include <set>
#include <cassert>
@@ -18,7 +18,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef int V;
typedef std::multiset<int> M;
@@ -110,5 +110,13 @@ int main(int, char**) {
}
#endif
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp
index 53630b3ca0a01..3ab2e1fbf55ce 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp
@@ -10,7 +10,7 @@
// class multiset
-// void swap(multiset& m);
+// void swap(multiset& m); // constexpr since C++26
#include <set>
#include <cassert>
@@ -18,7 +18,7 @@
#include "test_allocator.h"
#include "../../../test_compare.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
typedef int V;
{
typedef std::multiset<int> M;
@@ -100,5 +100,13 @@ int main(int, char**) {
assert(m2.get_allocator() == A(1));
}
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp b/libcxx/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp
index 7a7ccf87e9de9..37bdae66ee8e9 100644
--- a/libcxx/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/multiset.special/swap_noexcept.pass.cpp
@@ -12,11 +12,11 @@
// void swap(multiset& c)
// noexcept(!allocator_type::propagate_on_container_swap::value ||
-// __is_nothrow_swappable<allocator_type>::value);
+// __is_nothrow_swappable<allocator_type>::value); // constexpr since C++26
//
// In C++17, the standard says that swap shall have:
// noexcept(allocator_traits<Allocator>::is_always_equal::value &&
-// noexcept(swap(declval<Compare&>(), declval<Compare&>())));
+// noexcept(swap(declval<Compare&>(), declval<Compare&>()))); // constexpr since C++26
// This tests a conforming extension
@@ -86,7 +86,7 @@ struct some_alloc3 {
typedef std::false_type is_always_equal;
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::multiset<MoveOnly> C;
static_assert(noexcept(swap(std::declval<C&>(), std::declval<C&>())), "");
@@ -131,5 +131,13 @@ int main(int, char**) {
# endif // _LIBCPP_VERSION
#endif
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/size.pass.cpp b/libcxx/test/std/containers/associative/multiset/size.pass.cpp
index 405437211b8ca..4fe326b013fd4 100644
--- a/libcxx/test/std/containers/associative/multiset/size.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/size.pass.cpp
@@ -10,7 +10,7 @@
// class multiset
-// size_type size() const;
+// size_type size() const; // constexpr since C++26
#include <set>
#include <cassert>
@@ -18,7 +18,7 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef std::multiset<int> M;
M m;
@@ -55,6 +55,13 @@ int main(int, char**) {
assert(m.size() == 0);
}
#endif
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multiset/upper_bound.pass.cpp b/libcxx/test/std/containers/associative/multiset/upper_bound.pass.cpp
index c61859b1feffb..4e580d4318a71 100644
--- a/libcxx/test/std/containers/associative/multiset/upper_bound.pass.cpp
+++ b/libcxx/test/std/containers/associative/multiset/upper_bound.pass.cpp
@@ -10,8 +10,8 @@
// class multiset
-// iterator upper_bound(const key_type& k);
-// const_iterator upper_bound(const key_type& k) const;
+// iterator upper_bound(const key_type& k); // constexpr since C++26
+// const_iterator upper_bound(const key_type& k) const; // constexpr since C++26
#include <set>
#include <cassert>
@@ -20,7 +20,7 @@
#include "min_allocator.h"
#include "private_constructor.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
{
typedef int V;
typedef std::multiset<int> M;
@@ -163,6 +163,13 @@ int main(int, char**) {
assert(r == std::next(m.begin(), 9));
}
#endif
+ return true;
+}
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
return 0;
}
More information about the libcxx-commits
mailing list