[libcxx-commits] [libcxx] 8eae496 - [libc++] Make std::multimap constexpr as part of P3372R3 (#161901)
via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jun 19 07:19:39 PDT 2026
Author: Vinay Deshmukh
Date: 2026-06-19T10:19:34-04:00
New Revision: 8eae496effc992b28c12c23374e89474956b9860
URL: https://github.com/llvm/llvm-project/commit/8eae496effc992b28c12c23374e89474956b9860
DIFF: https://github.com/llvm/llvm-project/commit/8eae496effc992b28c12c23374e89474956b9860.diff
LOG: [libc++] Make std::multimap constexpr as part of P3372R3 (#161901)
Fixes #128661
Co-authored-by: Nikolas Klauser <nikolasklauser at berlin.de>
Co-authored-by: Louis Dionne <ldionne.2 at gmail.com>
Added:
Modified:
libcxx/include/map
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/map/map.cons/move_alloc.pass.cpp
libcxx/test/std/containers/associative/map/map.cons/move_assign.pass.cpp
libcxx/test/std/containers/associative/map/map.modifiers/merge.pass.cpp
libcxx/test/std/containers/associative/map/map.ops/contains.pass.cpp
libcxx/test/std/containers/associative/map/map.ops/contains_transparent.pass.cpp
libcxx/test/std/containers/associative/multimap/empty.pass.cpp
libcxx/test/std/containers/associative/multimap/get_allocator.pass.cpp
libcxx/test/std/containers/associative/multimap/incomplete_type.pass.cpp
libcxx/test/std/containers/associative/multimap/iterator.pass.cpp
libcxx/test/std/containers/associative/multimap/max_size.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/alloc.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/compare.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/deduct.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/deduct_const.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/default.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/from_range.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.erasure/erase_if.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/extract_iterator.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/extract_key.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_allocator_requirements.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_iter.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_node_type.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_node_type_hint.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_range.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.modifiers/merge.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.nonmember/compare.three_way.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.nonmember/op_compare.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.observers/key_comp.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.observers/value_comp.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/count_transparent.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range_transparent.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.special/member_swap.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.value_compare/invoke.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.value_compare/types.pass.cpp
libcxx/test/std/containers/associative/multimap/size.pass.cpp
libcxx/test/std/containers/associative/multimap/types.pass.cpp
libcxx/test/std/containers/container.node/node_handle.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/include/map b/libcxx/include/map
index c983a3ed07cd4..de0a475ee572f 100644
--- a/libcxx/include/map
+++ b/libcxx/include/map
@@ -1370,13 +1370,15 @@ public:
__tree_.__node_handle_merge_unique(__source.__tree_);
}
template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>& __source) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
+ merge(multimap<key_type, mapped_type, _Compare2, allocator_type>& __source) {
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
__source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
__tree_.__node_handle_merge_unique(__source.__tree_);
}
template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>&& __source) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
+ merge(multimap<key_type, mapped_type, _Compare2, allocator_type>&& __source) {
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
__source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
__tree_.__node_handle_merge_unique(__source.__tree_);
@@ -1739,10 +1741,11 @@ public:
protected:
key_compare comp;
- _LIBCPP_HIDE_FROM_ABI value_compare(key_compare __c) : comp(__c) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare(key_compare __c) : comp(__c) {}
public:
- _LIBCPP_HIDE_FROM_ABI bool operator()(const value_type& __x, const value_type& __y) const {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
+ operator()(const value_type& __x, const value_type& __y) const {
return comp(__x.first, __y.first);
}
};
@@ -1775,26 +1778,28 @@ public:
template <class _Key2, class _Value2, class _Comp2, class _Alloc2>
friend class multimap;
- _LIBCPP_HIDE_FROM_ABI multimap() _NOEXCEPT_(
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap() _NOEXCEPT_(
is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_default_constructible<key_compare>::value&&
is_nothrow_copy_constructible<key_compare>::value)
: __tree_(__vc(key_compare())) {}
- _LIBCPP_HIDE_FROM_ABI explicit multimap(const key_compare& __comp) _NOEXCEPT_(
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit multimap(const key_compare& __comp) _NOEXCEPT_(
is_nothrow_default_constructible<allocator_type>::value&& is_nothrow_copy_constructible<key_compare>::value)
: __tree_(__vc(__comp)) {}
- _LIBCPP_HIDE_FROM_ABI explicit multimap(const key_compare& __comp, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit multimap(const key_compare& __comp, const allocator_type& __a)
: __tree_(__vc(__comp), typename __base::allocator_type(__a)) {}
template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI multimap(_InputIterator __f, _InputIterator __l, const key_compare& __comp = key_compare())
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
+ multimap(_InputIterator __f, _InputIterator __l, const key_compare& __comp = key_compare())
: __tree_(__vc(__comp)) {
insert(__f, __l);
}
template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
multimap(_InputIterator __f, _InputIterator __l, const key_compare& __comp, const allocator_type& __a)
: __tree_(__vc(__comp), typename __base::allocator_type(__a)) {
insert(__f, __l);
@@ -1802,7 +1807,7 @@ public:
# if _LIBCPP_STD_VER >= 23
template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
multimap(from_range_t,
_Range&& __range,
const key_compare& __comp = key_compare(),
@@ -1814,45 +1819,50 @@ public:
# if _LIBCPP_STD_VER >= 14
template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI multimap(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
: multimap(__f, __l, key_compare(), __a) {}
# endif
# if _LIBCPP_STD_VER >= 23
template <_ContainerCompatibleRange<value_type> _Range>
- _LIBCPP_HIDE_FROM_ABI multimap(from_range_t, _Range&& __range, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap(from_range_t, _Range&& __range, const allocator_type& __a)
: multimap(from_range, std::forward<_Range>(__range), key_compare(), __a) {}
# endif
- _LIBCPP_HIDE_FROM_ABI multimap(const multimap& __m) = default;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap(const multimap& __m) = default;
- _LIBCPP_HIDE_FROM_ABI multimap& operator=(const multimap& __m) = default;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap& operator=(const multimap& __m) = default;
# ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI multimap(multimap&& __m) = default;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap(multimap&& __m) = default;
- _LIBCPP_HIDE_FROM_ABI multimap(multimap&& __m, const allocator_type& __a) : __tree_(std::move(__m.__tree_), __a) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap(multimap&& __m, const allocator_type& __a)
+ : __tree_(std::move(__m.__tree_), __a) {}
- _LIBCPP_HIDE_FROM_ABI multimap& operator=(multimap&& __m) = default;
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap& operator=(multimap&& __m) = default;
- _LIBCPP_HIDE_FROM_ABI multimap(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
+ multimap(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
: __tree_(__vc(__comp)) {
insert(__il.begin(), __il.end());
}
- _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
multimap(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a)
: __tree_(__vc(__comp), typename __base::allocator_type(__a)) {
insert(__il.begin(), __il.end());
}
# if _LIBCPP_STD_VER >= 14
- _LIBCPP_HIDE_FROM_ABI multimap(initializer_list<value_type> __il, const allocator_type& __a)
+ _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap(initializer_list<value_type> __il, const allocator_type& __a)
: multimap(__il, key_compare(), __a) {}
# endif
- _LIBCPP_HIDE_FROM_ABI multimap& operator=(initializer_list<value_type> __il) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap& operator=(initializer_list<value_type> __il) {
clear();
insert(__il.begin(), __il.end());
return *this;
@@ -1860,193 +1870,247 @@ public:
# endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI explicit multimap(const allocator_type& __a) : __tree_(typename __base::allocator_type(__a)) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit multimap(const allocator_type& __a)
+ : __tree_(typename __base::allocator_type(__a)) {}
- _LIBCPP_HIDE_FROM_ABI multimap(const multimap& __m, const allocator_type& __a) : __tree_(__m.__tree_, __a) {}
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 multimap(const multimap& __m, const allocator_type& __a)
+ : __tree_(__m.__tree_, __a) {}
- _LIBCPP_HIDE_FROM_ABI ~multimap() {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 ~multimap() {
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();
+ }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const _NOEXCEPT {
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 allocator_type get_allocator() const _NOEXCEPT {
return allocator_type(__tree_.__alloc());
}
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI key_compare key_comp() const { return __tree_.value_comp().key_comp(); }
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI value_compare value_comp() const {
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 key_compare key_comp() const {
+ return __tree_.value_comp().key_comp();
+ }
+ [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare value_comp() const {
return value_compare(__tree_.value_comp().key_comp());
}
# 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.__i_, std::forward<_Args>(__args)...);
}
template <class _Pp, __enable_if_t<is_constructible<value_type, _Pp>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI iterator insert(_Pp&& __p) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(_Pp&& __p) {
return __tree_.__emplace_multi(std::forward<_Pp>(__p));
}
template <class _Pp, __enable_if_t<is_constructible<value_type, _Pp>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI iterator insert(const_iterator __pos, _Pp&& __p) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator insert(const_iterator __pos, _Pp&& __p) {
return __tree_.__emplace_hint_multi(__pos.__i_, std::forward<_Pp>(__p));
}
- _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.__i_, 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 insert(const value_type& __v) { return __tree_.__emplace_multi(__v); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 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_iterator __p, const value_type& __v) {
return __tree_.__emplace_hint_multi(__p.__i_, __v);
}
template <class _InputIterator>
- _LIBCPP_HIDE_FROM_ABI void insert(_InputIterator __f, _InputIterator __l) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void insert(_InputIterator __f, _InputIterator __l) {
__tree_.__insert_range_multi(__f, __l);
}
# 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
- _LIBCPP_HIDE_FROM_ABI iterator erase(const_iterator __p) { return __tree_.erase(__p.__i_); }
- _LIBCPP_HIDE_FROM_ABI iterator erase(iterator __p) { return __tree_.erase(__p.__i_); }
- _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) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(const_iterator __p) {
+ return __tree_.erase(__p.__i_);
+ }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 iterator erase(iterator __p) { return __tree_.erase(__p.__i_); }
+ _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.__i_, __l.__i_);
}
# 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 multimap::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 multimap::insert()");
return __tree_.template __node_handle_insert_multi<node_type>(__hint.__i_, 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.__i_);
}
template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>& __source) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
+ merge(multimap<key_type, mapped_type, _Compare2, allocator_type>& __source) {
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
__source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
return __tree_.__node_handle_merge_multi(__source.__tree_);
}
template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>&& __source) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
+ merge(multimap<key_type, mapped_type, _Compare2, allocator_type>&& __source) {
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
__source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
return __tree_.__node_handle_merge_multi(__source.__tree_);
}
template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI void merge(map<key_type, mapped_type, _Compare2, allocator_type>& __source) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
+ merge(map<key_type, mapped_type, _Compare2, allocator_type>& __source) {
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
__source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
return __tree_.__node_handle_merge_multi(__source.__tree_);
}
template <class _Compare2>
- _LIBCPP_HIDE_FROM_ABI void merge(map<key_type, mapped_type, _Compare2, allocator_type>&& __source) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
+ merge(map<key_type, mapped_type, _Compare2, allocator_type>&& __source) {
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
__source.get_allocator() == get_allocator(), "merging container with incompatible allocator");
return __tree_.__node_handle_merge_multi(__source.__tree_);
}
# endif
- _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __tree_.clear(); }
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void clear() _NOEXCEPT { __tree_.clear(); }
- _LIBCPP_HIDE_FROM_ABI void swap(multimap& __m) _NOEXCEPT_(__is_nothrow_swappable_v<__base>) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(multimap& __m)
+ _NOEXCEPT_(__is_nothrow_swappable_v<__base>) {
__tree_.swap(__m.__tree_);
}
- [[__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);
}
@@ -2054,23 +2118,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);
}
@@ -2078,30 +2144,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
@@ -2175,7 +2246,7 @@ struct __specialized_algorithm<_Algorithm::__for_each, __single_range<multimap<_
static const bool __has_algorithm = true;
template <class _Map, class _Func, class _Proj>
- _LIBCPP_HIDE_FROM_ABI static auto operator()(_Map&& __map, _Func __func, _Proj __proj) {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static auto operator()(_Map&& __map, _Func __func, _Proj __proj) {
auto [_, __func2] = __specialized_algorithm<_Algorithm::__for_each, __single_range<typename __map::__base>>()(
__map.__tree_, std::move(__func), std::move(__proj));
return std::make_pair(__map.end(), std::move(__func2));
@@ -2184,7 +2255,7 @@ struct __specialized_algorithm<_Algorithm::__for_each, __single_range<multimap<_
# endif
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI bool
+inline _LIBCPP_HIDE_FROM_ABI bool _LIBCPP_CONSTEXPR_SINCE_CXX26
operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
return __x.size() == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin());
}
@@ -2192,31 +2263,31 @@ operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<
# if _LIBCPP_STD_VER <= 17
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
operator<(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
return std::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
return !(__x == __y);
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
operator>(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
return __y < __x;
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
return !(__x < __y);
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI bool
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool
operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
return !(__y < __x);
}
@@ -2224,7 +2295,7 @@ operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, const multimap<
# else // #if _LIBCPP_STD_VER <= 17
template <class _Key, class _Tp, class _Compare, class _Allocator>
-_LIBCPP_HIDE_FROM_ABI __synth_three_way_result<pair<const _Key, _Tp>>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __synth_three_way_result<pair<const _Key, _Tp>>
operator<=>(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
const multimap<_Key, _Tp, _Compare, _Allocator>& __y) {
return std::lexicographical_compare_three_way(__x.begin(), __x.end(), __y.begin(), __y.end(), __synth_three_way);
@@ -2233,7 +2304,7 @@ operator<=>(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
# endif // #if _LIBCPP_STD_VER <= 17
template <class _Key, class _Tp, class _Compare, class _Allocator>
-inline _LIBCPP_HIDE_FROM_ABI void
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
swap(multimap<_Key, _Tp, _Compare, _Allocator>& __x, multimap<_Key, _Tp, _Compare, _Allocator>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
__x.swap(__y);
@@ -2241,7 +2312,7 @@ swap(multimap<_Key, _Tp, _Compare, _Allocator>& __x, multimap<_Key, _Tp, _Compar
# if _LIBCPP_STD_VER >= 20
template <class _Key, class _Tp, class _Compare, class _Allocator, class _Predicate>
-inline _LIBCPP_HIDE_FROM_ABI typename multimap<_Key, _Tp, _Compare, _Allocator>::size_type
+inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename multimap<_Key, _Tp, _Compare, _Allocator>::size_type
erase_if(multimap<_Key, _Tp, _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 0fcd3ab27635a..645e1e4af792e 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
@@ -78,9 +78,7 @@ TEST_CONSTEXPR_CXX26 bool test() {
if (!TEST_IS_CONSTANT_EVALUATED)
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); });
- // FIXME: remove when multimap is made constexpr
- if (!TEST_IS_CONSTANT_EVALUATED)
- test_node_container<std::multimap<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); });
return true;
}
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 0a1bbe024cffa..e0186654e4bbc 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
@@ -258,11 +258,9 @@ TEST_CONSTEXPR_CXX26 bool test() {
// FIXME: remove when multiset is made constexpr
test_node_container<std::multiset<int> >([](int i) { return i; });
-
- // FIXME: remove when multimap is made constexpr
- test_node_container<std::multimap<int, int> >([](int i) { return std::make_pair(i, 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 set is made constexpr
@@ -270,12 +268,10 @@ TEST_CONSTEXPR_CXX26 bool test() {
// FIXME: remove when multiset is made constexpr
test_invoke_set_like<std::multiset>();
-
- // FIXME: remove when multimap is made constexpr
- test_invoke_map_like<std::multimap>();
}
test_invoke_map_like<std::map>();
+ test_invoke_map_like<std::multimap>();
return true;
}
diff --git a/libcxx/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp
index 169639f5afa78..a7bdbea189f8f 100644
--- a/libcxx/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp
@@ -161,6 +161,7 @@ int main(int, char**) {
#if TEST_STD_VER >= 26
// FIXME: It is not yet possible to replace a `const MoveOnly` key subobject during constant evaluation.
+ // See https://github.com/llvm/llvm-project/issues/204617.
// static_assert(test_move_alloc<MoveOnly>());
static_assert(test_move_alloc<CopyConstructible>());
#endif
diff --git a/libcxx/test/std/containers/associative/map/map.cons/move_assign.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/move_assign.pass.cpp
index 4fffb2fe04300..eeea47fc94d18 100644
--- a/libcxx/test/std/containers/associative/map/map.cons/move_assign.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.cons/move_assign.pass.cpp
@@ -107,6 +107,7 @@ int main(int, char**) {
#if TEST_STD_VER >= 26
// FIXME: It is not yet possible to replace a `const MoveOnly` key subobject during constant evaluation.
+ // See https://github.com/llvm/llvm-project/issues/204617.
// static_assert(test_move_assign<MoveOnly>());
static_assert(test_move_assign<CopyConstructible>());
#endif
diff --git a/libcxx/test/std/containers/associative/map/map.modifiers/merge.pass.cpp b/libcxx/test/std/containers/associative/map/map.modifiers/merge.pass.cpp
index c46234a8ff7fc..c3f8f266a929b 100644
--- a/libcxx/test/std/containers/associative/map/map.modifiers/merge.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.modifiers/merge.pass.cpp
@@ -132,7 +132,7 @@ bool test() {
first.merge(second);
first.merge(std::move(second));
}
- if (!TEST_IS_CONSTANT_EVALUATED) {
+ {
std::multimap<int, int> second;
first.merge(second);
first.merge(std::move(second));
diff --git a/libcxx/test/std/containers/associative/map/map.ops/contains.pass.cpp b/libcxx/test/std/containers/associative/map/map.ops/contains.pass.cpp
index 64ccb401e134c..e93b12bd71370 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/contains.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/contains.pass.cpp
@@ -49,8 +49,7 @@ TEST_CONSTEXPR_CXX26 bool test() {
test<std::map<int, E>, std::pair<int, E> >(
-1, std::make_pair(1, E{}), std::make_pair(2, E{}), std::make_pair(3, E{}), std::make_pair(4, E{}));
}
- // FIXME: remove when multimap is made constexpr
- if (!TEST_IS_CONSTANT_EVALUATED) {
+ {
test<std::multimap<char, int>, std::pair<char, int> >(
'e', std::make_pair('a', 10), std::make_pair('b', 11), std::make_pair('c', 12), std::make_pair('d', 13));
diff --git a/libcxx/test/std/containers/associative/map/map.ops/contains_transparent.pass.cpp b/libcxx/test/std/containers/associative/map/map.ops/contains_transparent.pass.cpp
index 778bd312469a9..4b9038f7121d6 100644
--- a/libcxx/test/std/containers/associative/map/map.ops/contains_transparent.pass.cpp
+++ b/libcxx/test/std/containers/associative/map/map.ops/contains_transparent.pass.cpp
@@ -41,11 +41,7 @@ TEST_CONSTEXPR_CXX26 bool test() {
TEST_CONSTEXPR_CXX26 bool test() {
test<std::map<std::pair<int, int>, int, Comp> >();
-
- // FIXME: remove when multimap is made constexpr
- if (!TEST_IS_CONSTANT_EVALUATED) {
- test<std::multimap<std::pair<int, int>, int, Comp> >();
- }
+ test<std::multimap<std::pair<int, int>, int, Comp> >();
return true;
}
diff --git a/libcxx/test/std/containers/associative/multimap/empty.pass.cpp b/libcxx/test/std/containers/associative/multimap/empty.pass.cpp
index c183cc385a916..bb7b6624b2991 100644
--- a/libcxx/test/std/containers/associative/multimap/empty.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/empty.pass.cpp
@@ -10,7 +10,7 @@
// class multimap
-// bool empty() const;
+// bool empty() const; // constexpr since C++26
#include <map>
#include <cassert>
@@ -18,7 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double> M;
M m;
@@ -40,5 +41,14 @@ 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/multimap/get_allocator.pass.cpp b/libcxx/test/std/containers/associative/multimap/get_allocator.pass.cpp
index 102dd0b5a36cc..92c128a9e5010 100644
--- a/libcxx/test/std/containers/associative/multimap/get_allocator.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/get_allocator.pass.cpp
@@ -10,7 +10,7 @@
// class multimap
-// allocator_type get_allocator() const
+// allocator_type get_allocator() const // constexpr since C++26
#include <map>
#include <cassert>
@@ -19,7 +19,8 @@
#include "test_allocator.h"
#include "test_macros.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::pair<const int, std::string> ValueType;
{
std::allocator<ValueType> alloc;
@@ -32,5 +33,14 @@ int main(int, char**) {
assert(m.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/multimap/incomplete_type.pass.cpp b/libcxx/test/std/containers/associative/multimap/incomplete_type.pass.cpp
index 470275aea064b..3bcd40cad9838 100644
--- a/libcxx/test/std/containers/associative/multimap/incomplete_type.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/incomplete_type.pass.cpp
@@ -26,11 +26,22 @@ struct A {
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**) {
+
+TEST_CONSTEXPR_CXX26
+bool test() {
A a;
// Make sure that the allocator isn't rebound to and incomplete type
std::multimap<int, int, std::less<int>, complete_type_allocator<std::pair<const int, int> > > 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/multimap/iterator.pass.cpp b/libcxx/test/std/containers/associative/multimap/iterator.pass.cpp
index ffdc39ff35563..dfac6418fcde1 100644
--- a/libcxx/test/std/containers/associative/multimap/iterator.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/iterator.pass.cpp
@@ -10,20 +10,20 @@
// class multimap
-// 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 <map>
#include <cassert>
@@ -32,7 +32,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::pair<const int, double> V;
V ar[] = {V(1, 1), V(1, 1.5), V(1, 2), V(2, 1), V(2, 1.5), V(2, 2), V(3, 1), V(3, 1.5),
@@ -165,5 +166,14 @@ 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/multimap/max_size.pass.cpp b/libcxx/test/std/containers/associative/multimap/max_size.pass.cpp
index c6208d27336b5..4d78bdaf99625 100644
--- a/libcxx/test/std/containers/associative/multimap/max_size.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/max_size.pass.cpp
@@ -10,7 +10,7 @@
// class multimap
-// size_type max_size() const;
+// size_type max_size() const; // constexpr since C++26
#include <cassert>
#include <limits>
@@ -20,7 +20,8 @@
#include "test_allocator.h"
#include "test_macros.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::pair<const int, int> KV;
{
typedef limited_allocator<KV, 10> A;
@@ -45,5 +46,14 @@ 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/multimap/multimap.cons/alloc.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/alloc.pass.cpp
index 10184633a82de..1d7af0ab1ffff 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/alloc.pass.cpp
@@ -10,7 +10,7 @@
// class multimap
-// explicit multimap(const allocator_type& a);
+// explicit multimap(const allocator_type& a); // constexpr since C++26
#include <map>
#include <cassert>
@@ -19,7 +19,8 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::less<int> C;
typedef test_allocator<std::pair<const int, double> > A;
@@ -47,5 +48,14 @@ 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/multimap/multimap.cons/assign_initializer_list.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp
index d1de8fab172cf..1c806c31f335c 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/assign_initializer_list.pass.cpp
@@ -12,7 +12,7 @@
// class multimap
-// multimap& operator=(initializer_list<value_type> il);
+// multimap& operator=(initializer_list<value_type> il); // constexpr since C++26
#include <map>
#include <cassert>
@@ -20,7 +20,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double> C;
typedef C::value_type V;
@@ -58,5 +59,14 @@ int main(int, char**) {
assert(*++i == V(3, 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/multimap/multimap.cons/compare.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/compare.pass.cpp
index 84584a427ead0..d9a2257dbacfc 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/compare.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/compare.pass.cpp
@@ -10,7 +10,7 @@
// class multimap
-// explicit multimap(const key_compare& comp);
+// explicit multimap(const key_compare& comp); // constexpr since C++26
#include <map>
#include <cassert>
@@ -19,7 +19,8 @@
#include "../../../test_compare.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef test_less<int> C;
const std::multimap<int, double, C> m(C(3));
@@ -37,5 +38,14 @@ 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/multimap/multimap.cons/compare_alloc.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp
index 207e7e271234f..a72bbabd376d3 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp
@@ -10,7 +10,7 @@
// class multimap
-// multimap(const key_compare& comp, const allocator_type& a);
+// multimap(const key_compare& comp, const allocator_type& a); // constexpr since C++26
#include <map>
#include <cassert>
@@ -20,7 +20,8 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef test_less<int> C;
typedef test_allocator<std::pair<const int, double> > A;
@@ -51,5 +52,14 @@ 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/multimap/multimap.cons/copy.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp
index 724755d1ef655..999d6be70b3c8 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp
@@ -10,7 +10,7 @@
// class multimap
-// multimap(const multimap& m);
+// multimap(const multimap& m); // constexpr since C++26
#include <map>
#include <cassert>
@@ -21,7 +21,7 @@
#include "min_allocator.h"
template <template <class> class Alloc>
-void test_alloc() {
+TEST_CONSTEXPR_CXX26 void test_alloc() {
{ // Simple check
using V = std::pair<const int, int>;
using Map = std::multimap<int, int, std::less<int>, Alloc<V> >;
@@ -83,7 +83,8 @@ void test_alloc() {
}
}
-void test() {
+TEST_CONSTEXPR_CXX26
+bool test() {
test_alloc<std::allocator>();
test_alloc<min_allocator>(); // Make sure that fancy pointers work
@@ -132,10 +133,14 @@ void test() {
assert(orig.size() == 3);
assert(orig.get_allocator() == other_allocator<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/multimap/multimap.cons/copy_alloc.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp
index 055efaecfca54..5414bfd4444bc 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/copy_alloc.pass.cpp
@@ -10,7 +10,7 @@
// class multimap
-// multimap(const multimap& m, const allocator_type& a);
+// multimap(const multimap& m, const allocator_type& a); // constexpr since C++26
#include <map>
#include <cassert>
@@ -21,7 +21,7 @@
#include "min_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 V = std::pair<const int, int>;
using Map = std::multimap<int, int, std::less<int>, Alloc>;
@@ -83,7 +83,8 @@ void test_alloc(const Alloc& new_alloc) {
}
}
-void test() {
+TEST_CONSTEXPR_CXX26
+bool test() {
test_alloc(std::allocator<std::pair<const int, int> >());
test_alloc(test_allocator<std::pair<const int, int> >(25)); // Make sure that the new allocator is actually used
test_alloc(min_allocator<std::pair<const int, int> >()); // Make sure that fancy pointers work
@@ -102,10 +103,15 @@ 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/multimap/multimap.cons/copy_assign.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp
index e52da3a4a6313..945cf9d7cdd2a 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/copy_assign.pass.cpp
@@ -6,11 +6,13 @@
//
//===----------------------------------------------------------------------===//
+// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=2147483647
+
// <map>
// class multimap
-// multimap& operator=(const multimap& m);
+// multimap& operator=(const multimap& m); // constexpr since C++26
#include <algorithm>
#include <cassert>
@@ -33,17 +35,20 @@ class tracking_allocator {
using value_type = T;
using propagate_on_container_copy_assignment = std::true_type;
+ 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_) {}
+ TEST_CONSTEXPR_CXX26
T* allocate(std::size_t n) {
T* allocation = std::allocator<T>().allocate(n);
allocs_->push_back(allocation);
return allocation;
}
+ 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?");
@@ -51,23 +56,27 @@ class tracking_allocator {
std::allocator<T>().deallocate(ptr, n);
}
+ TEST_CONSTEXPR_CXX26
friend bool operator==(const tracking_allocator& lhs, const tracking_allocator& rhs) {
return lhs.allocs_ == rhs.allocs_;
}
+ TEST_CONSTEXPR_CXX26
friend bool operator!=(const tracking_allocator& lhs, const tracking_allocator& rhs) {
return lhs.allocs_ != rhs.allocs_;
}
};
struct NoOp {
+ 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 multimap combinations
{ // assign from a non-empty container into an empty one
using V = std::pair<const int, int>;
@@ -245,7 +254,8 @@ void test_alloc(const Alloc& lhs_alloc = Alloc(),
check_alloc_invariant();
}
-void test() {
+TEST_CONSTEXPR_CXX26
+bool test() {
test_alloc<std::allocator<std::pair<const int, int> > >();
#if TEST_STD_VER >= 11
test_alloc<min_allocator<std::pair<const int, int> > >();
@@ -257,9 +267,11 @@ void test() {
std::vector<void*>* rhs_allocs_;
public:
+ TEST_CONSTEXPR_CXX26
AssertEmpty(std::vector<void*>& lhs_allocs, std::vector<void*>& rhs_allocs)
: lhs_allocs_(&lhs_allocs), rhs_allocs_(&rhs_allocs) {}
+ TEST_CONSTEXPR_CXX26
void operator()() {
assert(lhs_allocs_->empty());
assert(rhs_allocs_->empty());
@@ -288,10 +300,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/multimap/multimap.cons/deduct.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/deduct.pass.cpp
index 1e318890e58ac..268cacafa82e9 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/deduct.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/deduct.pass.cpp
@@ -51,7 +51,8 @@
using P = std::pair<int, long>;
using PC = std::pair<const int, long>;
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
const P arr[] = {{1, 1L}, {2, 2L}, {1, 1L}, {INT_MAX, 1L}, {3, 1L}};
std::multimap m(std::begin(arr), std::end(arr));
@@ -214,5 +215,14 @@ int main(int, char**) {
AssociativeContainerDeductionGuidesSfinaeAway<std::multimap, std::multimap<int, long>>();
+ 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/multimap/multimap.cons/deduct_const.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/deduct_const.pass.cpp
index ae1e5622797cd..8323a28f6562f 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/deduct_const.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/deduct_const.pass.cpp
@@ -39,7 +39,8 @@ using P = std::pair<int, long>;
using PC = std::pair<const int, long>;
using PCC = std::pair<const int, const long>;
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
const PCC arr[] = {{1, 1L}, {2, 2L}, {1, 1L}, {INT_MAX, 1L}, {3, 1L}};
std::multimap m(std::begin(arr), std::end(arr));
@@ -103,5 +104,14 @@ int main(int, char**) {
assert(m.get_allocator().get_id() == 45);
}
+ 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/multimap/multimap.cons/default.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/default.pass.cpp
index f74723b3174f0..ec495b886271c 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/default.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/default.pass.cpp
@@ -10,7 +10,7 @@
// class multimap
-// multimap();
+// multimap(); // constexpr since C++26
#include <map>
#include <cassert>
@@ -18,7 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
std::multimap<int, double> m;
assert(m.empty());
@@ -51,5 +52,14 @@ 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/multimap/multimap.cons/default_noexcept.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp
index b6c4e0336394d..29a4068c83070 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/default_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.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,8 @@ struct some_comp {
bool operator()(const T&, const T&) const { return false; }
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::pair<const MoveOnly, MoveOnly> V;
#if defined(_LIBCPP_VERSION)
{
@@ -53,5 +54,14 @@ 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/multimap/multimap.cons/dtor_noexcept.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp
index c757befb9211c..4dae0bbe6a314 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/dtor_noexcept.pass.cpp
@@ -8,7 +8,7 @@
// <map>
-// ~multimap() // implied noexcept;
+// ~multimap() // implied noexcept; // constexpr since C++26
// UNSUPPORTED: c++03
@@ -27,7 +27,8 @@ struct some_comp {
bool operator()(const T&, const T&) const { return false; }
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::multimap<MoveOnly, MoveOnly> C;
@@ -48,5 +49,14 @@ 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/multimap/multimap.cons/from_range.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/from_range.pass.cpp
index fd8ca64f1cce6..03b2f7f90fc2c 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/from_range.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/from_range.pass.cpp
@@ -9,11 +9,11 @@
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// template<container-compatible-range<value_type> R>
-// multimap(from_range_t, R&& rg, const Compare& comp = Compare(), const Allocator& = Allocator()); // C++23
+// multimap(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>
// multimap(from_range_t, R&& rg, const Allocator& a))
-// : multimap(from_range, std::forward<R>(rg), Compare(), a) { } // C++23
+// : multimap(from_range, std::forward<R>(rg), Compare(), a) { } // C++23, constexpr since C++26
#include <array>
#include <map>
@@ -21,6 +21,7 @@
#include "../../from_range_associative_containers.h"
#include "test_macros.h"
+TEST_CONSTEXPR_CXX26
void test_duplicates() {
using T = std::pair<const int, char>;
std::array input = {T{1, 'a'}, T{2, 'a'}, T{3, 'a'}, T{3, 'b'}, T{3, 'c'}, T{2, 'b'}, T{4, 'a'}};
@@ -28,7 +29,8 @@ void test_duplicates() {
assert(std::ranges::is_permutation(input, c));
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
using T = std::pair<const int, int>;
for_all_iterators_and_allocators<T>([]<class Iter, class Sent, class Alloc>() {
test_associative_map<std::multimap, int, int, Iter, Sent, test_less<int>, Alloc>();
@@ -41,5 +43,14 @@ int main(int, char**) {
test_map_exception_safety_throwing_copy<std::multimap>();
test_map_exception_safety_throwing_allocator<std::multimap, int, 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/multimap/multimap.cons/initializer_list.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp
index db91af00359e8..63fd9d205d746 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/initializer_list.pass.cpp
@@ -12,7 +12,7 @@
// class multimap
-// multimap(initializer_list<value_type> il, const key_compare& comp = key_compare());
+// multimap(initializer_list<value_type> il, const key_compare& comp = key_compare()); // constexpr since C++26
#include <map>
#include <cassert>
@@ -20,7 +20,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double> C;
typedef C::value_type V;
@@ -56,5 +57,14 @@ int main(int, char**) {
assert(*++i == V(3, 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/multimap/multimap.cons/initializer_list_compare.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp
index 0d346d7226353..34b8da52d4b67 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare.pass.cpp
@@ -12,7 +12,7 @@
// class multimap
-// multimap(initializer_list<value_type> il, const key_compare& comp = key_compare());
+// multimap(initializer_list<value_type> il, const key_compare& comp = key_compare()); // constexpr since C++26
#include <map>
#include <cassert>
@@ -20,7 +20,8 @@
#include "../../../test_compare.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef test_less<int> Cmp;
typedef std::multimap<int, double, Cmp> C;
@@ -60,5 +61,14 @@ int main(int, char**) {
assert(m.key_comp() == Cmp(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/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp
index 493f1bafbc1b7..941067c952415 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/initializer_list_compare_alloc.pass.cpp
@@ -12,7 +12,7 @@
// class multimap
-// multimap(initializer_list<value_type> il, const key_compare& comp, const allocator_type& a);
+// multimap(initializer_list<value_type> il, const key_compare& comp, const allocator_type& a); // constexpr since C++26
#include <map>
#include <cassert>
@@ -21,7 +21,8 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef test_less<int> Cmp;
typedef test_allocator<std::pair<const int, double> > A;
@@ -108,5 +109,14 @@ 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/multimap/multimap.cons/iter_iter.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp
index 55542914f9a01..bc558bf3b233b 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/iter_iter.pass.cpp
@@ -11,7 +11,7 @@
// class multimap
// template <class InputIterator>
-// multimap(InputIterator first, InputIterator last);
+// multimap(InputIterator first, InputIterator last); // constexpr since C++26
#include <map>
#include <cassert>
@@ -19,7 +19,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::pair<const int, double> V;
V ar[] = {
@@ -106,5 +107,14 @@ int main(int, char**) {
# endif
#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/multimap/multimap.cons/iter_iter_comp.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp
index 128d54a3d6b4e..7d54b05f6cd01 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp.pass.cpp
@@ -12,7 +12,7 @@
// template <class InputIterator>
// multimap(InputIterator first, InputIterator last,
-// const key_compare& comp);
+// const key_compare& comp); // constexpr since C++26
#include <map>
#include <cassert>
@@ -21,7 +21,8 @@
#include "../../../test_compare.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::pair<const int, double> V;
V ar[] = {
@@ -81,5 +82,14 @@ 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/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp
index 68d658c2edf85..fb3f4b831cc0d 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/iter_iter_comp_alloc.pass.cpp
@@ -12,7 +12,7 @@
// template <class InputIterator>
// multimap(InputIterator first, InputIterator last,
-// const key_compare& comp, const allocator_type& a);
+// const key_compare& comp, const allocator_type& a); // constexpr since C++26
#include <map>
#include <cassert>
@@ -22,7 +22,8 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::pair<const int, double> V;
V ar[] = {
@@ -116,5 +117,14 @@ 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/multimap/multimap.cons/move.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp
index d229c6f7d5f49..fbf4328d17764 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/move.pass.cpp
@@ -12,7 +12,7 @@
// class multimap
-// multimap(multimap&& m);
+// multimap(multimap&& m); // constexpr since C++26
#include <map>
#include <cassert>
@@ -22,7 +22,8 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::pair<const int, double> V;
{
typedef test_less<int> C;
@@ -127,5 +128,14 @@ 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/multimap/multimap.cons/move_alloc.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp
index 31ff8ff792566..1a8d6a72a62ff 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/move_alloc.pass.cpp
@@ -12,7 +12,7 @@
// class multimap
-// multimap(multimap&& m, const allocator_type& a);
+// multimap(multimap&& m, const allocator_type& a); // constexpr since C++26
#include <map>
#include <cassert>
@@ -24,7 +24,8 @@
#include "min_allocator.h"
#include "Counter.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::pair<MoveOnly, MoveOnly> V;
typedef std::pair<const MoveOnly, MoveOnly> VC;
@@ -150,5 +151,15 @@ int main(int, char**) {
LIBCPP_ASSERT(m1.empty());
}
+ return true;
+}
+
+int main(int, char**) {
+ test();
+#if TEST_STD_VER >= 26
+// FIXME: Within __tree, it is not allowed to move from a `const MoveOnly` which prevents this from executing during constant evaluation
+// See https://github.com/llvm/llvm-project/issues/204617.
+// static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp
index bbf766eec3e40..58dbf233ddcb2 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/move_assign.pass.cpp
@@ -12,7 +12,7 @@
// class multimap
-// multimap& operator=(multimap&& m);
+// multimap& operator=(multimap&& m); // constexpr since C++26
#include <map>
#include <cassert>
@@ -23,7 +23,8 @@
#include "test_allocator.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::pair<MoveOnly, MoveOnly> V;
typedef std::pair<const MoveOnly, MoveOnly> VC;
@@ -97,5 +98,16 @@ int main(int, char**) {
assert(m1.empty());
}
+ return true;
+}
+
+int main(int, char**) {
+ test();
+
+#if TEST_STD_VER >= 26
+// FIXME: Within __tree, it is not allowed to move from a `const MoveOnly` which prevents this from executing during constant evaluation
+// See https://github.com/llvm/llvm-project/issues/204617.
+// static_assert(test());
+#endif
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp
index 2af0324575d9c..b1d0f31da99f2 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.cons/move_noexcept.pass.cpp
@@ -10,7 +10,7 @@
// multimap(multimap&&)
// 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,8 @@ 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::pair<const MoveOnly, MoveOnly> V;
{
@@ -51,5 +52,14 @@ 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/multimap/multimap.erasure/erase_if.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.erasure/erase_if.pass.cpp
index 4391bb36f741f..b4abda433aae3 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.erasure/erase_if.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.erasure/erase_if.pass.cpp
@@ -11,7 +11,7 @@
// template <class Key, class T, class Compare, class Allocator, class Predicate>
// typename multimap<Key, T, Compare, Allocator>::size_type
-// erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred);
+// erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred); // constexpr since C++26
#include <map>
@@ -21,7 +21,7 @@
using Init = std::initializer_list<int>;
template <typename M>
-M make(Init vals) {
+TEST_CONSTEXPR_CXX26 M make(Init vals) {
M ret;
for (int v : vals)
ret.emplace(static_cast<typename M::key_type>(v), static_cast<typename M::mapped_type>(v + 10));
@@ -29,7 +29,7 @@ M make(Init vals) {
}
template <typename M, typename Pred>
-void test0(Init vals, Pred p, Init expected, std::size_t expected_erased_count) {
+TEST_CONSTEXPR_CXX26 void test0(Init vals, Pred p, Init expected, std::size_t expected_erased_count) {
M s = make<M>(vals);
ASSERT_SAME_TYPE(typename M::size_type, decltype(std::erase_if(s, p)));
assert(expected_erased_count == std::erase_if(s, p));
@@ -37,7 +37,7 @@ void test0(Init vals, Pred p, Init expected, std::size_t expected_erased_count)
}
template <typename S>
-void test() {
+TEST_CONSTEXPR_CXX26 void test() {
auto is1 = [](auto v) { return v.first == 1; };
auto is2 = [](auto v) { return v.first == 2; };
auto is3 = [](auto v) { return v.first == 3; };
@@ -74,7 +74,8 @@ void test() {
test0<S>({1, 2, 3}, False, {1, 2, 3}, 0);
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test_all() {
test<std::multimap<int, int>>();
test<std::multimap<int, int, std::less<int>, min_allocator<std::pair<const int, int>>>>();
test<std::multimap<int, int, std::less<int>, test_allocator<std::pair<const int, int>>>>();
@@ -82,5 +83,21 @@ int main(int, char**) {
test<std::multimap<long, short>>();
test<std::multimap<short, double>>();
+ return true;
+}
+
+int main(int, char**) {
+ test_all();
+
+#if TEST_STD_VER >= 26
+# ifndef TEST_COMPILER_GCC
+ // FIXME(LLVM23): Fails with g++-15 with:
+ // clang-format off
+ // __tree:116:23: error: ''result_decl' not supported by dump_expr<expression error>' is not a constant expression
+ // clang-format on
+ static_assert(test_all());
+# endif
+#endif
+
return 0;
}
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp
index 08dfcea99cf5b..3c3a6d53cb67c 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/clear.pass.cpp
@@ -10,7 +10,7 @@
// class multimap
-// void clear() noexcept;
+// void clear() noexcept; // constexpr since C++26
#include <map>
#include <cassert>
@@ -18,7 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double> M;
typedef std::pair<int, double> P;
@@ -60,5 +61,14 @@ 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/multimap/multimap.modifiers/emplace.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp
index 9a7526c16adf7..67ebd3ff8c631 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/emplace.pass.cpp
@@ -13,7 +13,7 @@
// class multimap
// template <class... Args>
-// iterator emplace(Args&&... args);
+// iterator emplace(Args&&... args); // constexpr since C++26
#include <map>
#include <cassert>
@@ -23,32 +23,36 @@
#include "DefaultOnly.h"
#include "min_allocator.h"
-int main(int, char**) {
- {
- typedef std::multimap<int, DefaultOnly> M;
- typedef M::iterator R;
- M m;
+TEST_CONSTEXPR_CXX26
+bool test() {
+ // DefaultOnly::count is static
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ {
+ typedef std::multimap<int, DefaultOnly> M;
+ typedef M::iterator R;
+ M m;
+ assert(DefaultOnly::count == 0);
+ R r = m.emplace();
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 0);
+ assert(m.begin()->second == DefaultOnly());
+ assert(DefaultOnly::count == 1);
+ r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
+ assert(r == std::next(m.begin()));
+ assert(m.size() == 2);
+ assert(std::next(m.begin())->first == 1);
+ assert(std::next(m.begin())->second == DefaultOnly());
+ assert(DefaultOnly::count == 2);
+ r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
+ assert(r == std::next(m.begin(), 2));
+ assert(m.size() == 3);
+ assert(std::next(m.begin(), 2)->first == 1);
+ assert(std::next(m.begin(), 2)->second == DefaultOnly());
+ assert(DefaultOnly::count == 3);
+ }
assert(DefaultOnly::count == 0);
- R r = m.emplace();
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(m.begin()->first == 0);
- assert(m.begin()->second == DefaultOnly());
- assert(DefaultOnly::count == 1);
- r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
- assert(r == std::next(m.begin()));
- assert(m.size() == 2);
- assert(std::next(m.begin())->first == 1);
- assert(std::next(m.begin())->second == DefaultOnly());
- assert(DefaultOnly::count == 2);
- r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
- assert(r == std::next(m.begin(), 2));
- assert(m.size() == 3);
- assert(std::next(m.begin(), 2)->first == 1);
- assert(std::next(m.begin(), 2)->second == DefaultOnly());
- assert(DefaultOnly::count == 3);
}
- assert(DefaultOnly::count == 0);
{
typedef std::multimap<int, Emplaceable> M;
typedef M::iterator R;
@@ -79,31 +83,33 @@ int main(int, char**) {
assert(m.begin()->first == 2);
assert(m.begin()->second == 3.5);
}
- {
- typedef std::multimap<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M;
- typedef M::iterator R;
- M m;
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ {
+ typedef std::multimap<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M;
+ typedef M::iterator R;
+ M m;
+ assert(DefaultOnly::count == 0);
+ R r = m.emplace();
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 0);
+ assert(m.begin()->second == DefaultOnly());
+ assert(DefaultOnly::count == 1);
+ r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
+ assert(r == std::next(m.begin()));
+ assert(m.size() == 2);
+ assert(std::next(m.begin())->first == 1);
+ assert(std::next(m.begin())->second == DefaultOnly());
+ assert(DefaultOnly::count == 2);
+ r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
+ assert(r == std::next(m.begin(), 2));
+ assert(m.size() == 3);
+ assert(std::next(m.begin(), 2)->first == 1);
+ assert(std::next(m.begin(), 2)->second == DefaultOnly());
+ assert(DefaultOnly::count == 3);
+ }
assert(DefaultOnly::count == 0);
- R r = m.emplace();
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(m.begin()->first == 0);
- assert(m.begin()->second == DefaultOnly());
- assert(DefaultOnly::count == 1);
- r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
- assert(r == std::next(m.begin()));
- assert(m.size() == 2);
- assert(std::next(m.begin())->first == 1);
- assert(std::next(m.begin())->second == DefaultOnly());
- assert(DefaultOnly::count == 2);
- r = m.emplace(std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
- assert(r == std::next(m.begin(), 2));
- assert(m.size() == 3);
- assert(std::next(m.begin(), 2)->first == 1);
- assert(std::next(m.begin(), 2)->second == DefaultOnly());
- assert(DefaultOnly::count == 3);
}
- assert(DefaultOnly::count == 0);
{
typedef std::multimap<int, Emplaceable, std::less<int>, min_allocator<std::pair<const int, Emplaceable>>> M;
typedef M::iterator R;
@@ -135,5 +141,14 @@ int main(int, char**) {
assert(m.begin()->second == 3.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/multimap/multimap.modifiers/emplace_hint.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp
index 8b9081082bb23..6b169cc4e4d5c 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/emplace_hint.pass.cpp
@@ -13,7 +13,7 @@
// class multimap
// template <class... Args>
-// iterator emplace_hint(const_iterator position, Args&&... args);
+// iterator emplace_hint(const_iterator position, Args&&... args); // constexpr since C++26
#include <map>
#include <cassert>
@@ -23,32 +23,36 @@
#include "DefaultOnly.h"
#include "min_allocator.h"
-int main(int, char**) {
- {
- typedef std::multimap<int, DefaultOnly> M;
- typedef M::iterator R;
- M m;
+TEST_CONSTEXPR_CXX26
+bool test() {
+ // DefaultOnly::count is static
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ {
+ typedef std::multimap<int, DefaultOnly> M;
+ typedef M::iterator R;
+ M m;
+ assert(DefaultOnly::count == 0);
+ R r = m.emplace_hint(m.cend());
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 0);
+ assert(m.begin()->second == DefaultOnly());
+ assert(DefaultOnly::count == 1);
+ r = m.emplace_hint(m.cend(), std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
+ assert(r == std::next(m.begin()));
+ assert(m.size() == 2);
+ assert(std::next(m.begin())->first == 1);
+ assert(std::next(m.begin())->second == DefaultOnly());
+ assert(DefaultOnly::count == 2);
+ r = m.emplace_hint(m.cend(), std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
+ assert(r == std::next(m.begin(), 2));
+ assert(m.size() == 3);
+ assert(std::next(m.begin(), 2)->first == 1);
+ assert(std::next(m.begin(), 2)->second == DefaultOnly());
+ assert(DefaultOnly::count == 3);
+ }
assert(DefaultOnly::count == 0);
- R r = m.emplace_hint(m.cend());
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(m.begin()->first == 0);
- assert(m.begin()->second == DefaultOnly());
- assert(DefaultOnly::count == 1);
- r = m.emplace_hint(m.cend(), std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
- assert(r == std::next(m.begin()));
- assert(m.size() == 2);
- assert(std::next(m.begin())->first == 1);
- assert(std::next(m.begin())->second == DefaultOnly());
- assert(DefaultOnly::count == 2);
- r = m.emplace_hint(m.cend(), std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
- assert(r == std::next(m.begin(), 2));
- assert(m.size() == 3);
- assert(std::next(m.begin(), 2)->first == 1);
- assert(std::next(m.begin(), 2)->second == DefaultOnly());
- assert(DefaultOnly::count == 3);
}
- assert(DefaultOnly::count == 0);
{
typedef std::multimap<int, Emplaceable> M;
typedef M::iterator R;
@@ -79,31 +83,33 @@ int main(int, char**) {
assert(m.begin()->first == 2);
assert(m.begin()->second == 3.5);
}
- {
- typedef std::multimap<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M;
- typedef M::iterator R;
- M m;
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ {
+ typedef std::multimap<int, DefaultOnly, std::less<int>, min_allocator<std::pair<const int, DefaultOnly>>> M;
+ typedef M::iterator R;
+ M m;
+ assert(DefaultOnly::count == 0);
+ R r = m.emplace_hint(m.cend());
+ assert(r == m.begin());
+ assert(m.size() == 1);
+ assert(m.begin()->first == 0);
+ assert(m.begin()->second == DefaultOnly());
+ assert(DefaultOnly::count == 1);
+ r = m.emplace_hint(m.cend(), std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
+ assert(r == std::next(m.begin()));
+ assert(m.size() == 2);
+ assert(std::next(m.begin())->first == 1);
+ assert(std::next(m.begin())->second == DefaultOnly());
+ assert(DefaultOnly::count == 2);
+ r = m.emplace_hint(m.cend(), std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
+ assert(r == std::next(m.begin(), 2));
+ assert(m.size() == 3);
+ assert(std::next(m.begin(), 2)->first == 1);
+ assert(std::next(m.begin(), 2)->second == DefaultOnly());
+ assert(DefaultOnly::count == 3);
+ }
assert(DefaultOnly::count == 0);
- R r = m.emplace_hint(m.cend());
- assert(r == m.begin());
- assert(m.size() == 1);
- assert(m.begin()->first == 0);
- assert(m.begin()->second == DefaultOnly());
- assert(DefaultOnly::count == 1);
- r = m.emplace_hint(m.cend(), std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
- assert(r == std::next(m.begin()));
- assert(m.size() == 2);
- assert(std::next(m.begin())->first == 1);
- assert(std::next(m.begin())->second == DefaultOnly());
- assert(DefaultOnly::count == 2);
- r = m.emplace_hint(m.cend(), std::piecewise_construct, std::forward_as_tuple(1), std::forward_as_tuple());
- assert(r == std::next(m.begin(), 2));
- assert(m.size() == 3);
- assert(std::next(m.begin(), 2)->first == 1);
- assert(std::next(m.begin(), 2)->second == DefaultOnly());
- assert(DefaultOnly::count == 3);
}
- assert(DefaultOnly::count == 0);
{
typedef std::multimap<int, Emplaceable, std::less<int>, min_allocator<std::pair<const int, Emplaceable>>> M;
typedef M::iterator R;
@@ -135,5 +141,14 @@ int main(int, char**) {
assert(m.begin()->second == 3.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/multimap/multimap.modifiers/erase_iter.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp
index 67e957e9e3a72..d9ad536c3acea 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/erase_iter.pass.cpp
@@ -10,7 +10,7 @@
// class multimap
-// iterator erase(const_iterator position);
+// iterator erase(const_iterator position); // constexpr since C++26
#include <map>
#include <cassert>
@@ -20,12 +20,14 @@
struct TemplateConstructor {
template <typename T>
- TemplateConstructor(const T&) {}
+ TEST_CONSTEXPR_CXX26 TemplateConstructor(const T&) {}
};
+TEST_CONSTEXPR_CXX26
bool operator<(const TemplateConstructor&, const TemplateConstructor&) { return false; }
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double> M;
typedef std::pair<int, double> P;
@@ -295,5 +297,14 @@ 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/multimap/multimap.modifiers/erase_iter_iter.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp
index 22a34a19d9897..25e8e7ceb8606 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/erase_iter_iter.pass.cpp
@@ -10,7 +10,7 @@
// class multimap
-// iterator erase(const_iterator first, const_iterator last);
+// iterator erase(const_iterator first, const_iterator last); // constexpr since C++26
#include <map>
#include <cassert>
@@ -18,7 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double> M;
typedef std::pair<int, double> P;
@@ -152,5 +153,14 @@ 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/multimap/multimap.modifiers/erase_key.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp
index 1dde462f096a1..a3340cd517168 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/erase_key.pass.cpp
@@ -10,7 +10,7 @@
// class multimap
-// size_type erase(const key_type& k);
+// size_type erase(const key_type& k); // constexpr since C++26
#include <map>
#include <cassert>
@@ -18,7 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double> M;
typedef std::pair<int, double> P;
@@ -148,5 +149,14 @@ 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/multimap/multimap.modifiers/extract_iterator.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/extract_iterator.pass.cpp
index 85beba3015e56..bc4f0a49addd3 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/extract_iterator.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/extract_iterator.pass.cpp
@@ -12,7 +12,7 @@
// class multimap
-// node_type extract(const_iterator);
+// node_type extract(const_iterator); // constexpr since C++26
#include <map>
#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();
auto some_key = c.cbegin()->first;
@@ -29,9 +29,13 @@ void test(Container& c) {
auto key_value = first->first;
typename Container::node_type t = c.extract(first++);
--sz;
- assert(t.key() == key_value);
- t.key() = some_key;
- assert(t.key() == some_key);
+
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ // FIXME: CWG1514: key() is not `constexpr`
+ assert(t.key() == key_value);
+ t.key() = some_key;
+ assert(t.key() == some_key);
+ }
assert(t.get_allocator() == c.get_allocator());
assert(sz == c.size());
}
@@ -39,14 +43,16 @@ void test(Container& c) {
assert(c.size() == 0);
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
using map_type = std::multimap<int, int>;
map_type m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
test(m);
}
- {
+ // Counter_base::gConstructed is static
+ if (!TEST_IS_CONSTANT_EVALUATED) {
std::multimap<Counter<int>, Counter<int>> m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
assert(Counter_base::gConstructed == 12);
test(m);
@@ -59,5 +65,14 @@ 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/multimap/multimap.modifiers/extract_key.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/extract_key.pass.cpp
index 42184edbdb8b6..e1d71a5103088 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/extract_key.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/extract_key.pass.cpp
@@ -12,7 +12,7 @@
// class multimap
-// node_type extract(key_type const&);
+// node_type extract(key_type const&); // constexpr since C++26
#include <map>
#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);
@@ -28,9 +28,11 @@ void test(Container& c, KeyTypeIter first, KeyTypeIter last) {
typename Container::node_type t = c.extract(*copy);
assert(!t.empty());
--sz;
- assert(t.key() == *copy);
- t.key() = *first; // We should be able to mutate key.
- assert(t.key() == *first);
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ assert(t.key() == *copy);
+ t.key() = *first; // We should be able to mutate key.
+ assert(t.key() == *first);
+ }
assert(t.get_allocator() == c.get_allocator());
assert(sz == c.size());
}
@@ -43,7 +45,8 @@ void test(Container& c, KeyTypeIter first, KeyTypeIter last) {
}
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
std::multimap<int, int> m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
int keys[] = {1, 2, 3, 4, 5, 6};
@@ -54,7 +57,10 @@ int main(int, char**) {
std::multimap<int, int> m = {{1, 1}, {1, 2}, {1, 3}};
auto ptr = std::addressof(m.begin()->first);
auto res = m.extract(1);
- assert(std::addressof(res.key()) == ptr);
+ if (!TEST_IS_CONSTANT_EVALUATED) {
+ // CWG1514: key() is not `constexpr`
+ assert(std::addressof(res.key()) == ptr);
+ }
}
{ // Check that no element is returned if there is no match
@@ -63,7 +69,7 @@ int main(int, char**) {
assert(!res);
}
- {
+ if (!TEST_IS_CONSTANT_EVALUATED) {
std::multimap<Counter<int>, Counter<int>> m = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}};
{
Counter<int> keys[] = {1, 2, 3, 4, 5, 6};
@@ -80,5 +86,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/multimap/multimap.modifiers/insert_allocator_requirements.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_allocator_requirements.pass.cpp
index 68767d002d0ca..484efe892c843 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_allocator_requirements.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_allocator_requirements.pass.cpp
@@ -10,7 +10,7 @@
// class multimap
-// insert(...)
+// insert(...) // constexpr since C++26
// UNSUPPORTED: c++03
diff --git a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp
index a6869a73e1e04..1bcab020ae19d 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_cv.pass.cpp
@@ -10,7 +10,7 @@
// class multimap
-// iterator insert(const value_type& v);
+// iterator insert(const value_type& v); // constexpr since C++26
#include <map>
#include <cassert>
@@ -19,7 +19,7 @@
#include "min_allocator.h"
template <class Container>
-void do_insert_test() {
+TEST_CONSTEXPR_CXX26 void do_insert_test() {
typedef Container M;
typedef typename M::iterator R;
typedef typename M::value_type VT;
@@ -53,7 +53,8 @@ void do_insert_test() {
assert(r->second == 3.5);
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double> Container;
do_insert_test<Container>();
@@ -65,5 +66,14 @@ 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/multimap/multimap.modifiers/insert_initializer_list.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp
index a8f40aa2b09e4..4c4eb9765701b 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_initializer_list.pass.cpp
@@ -12,7 +12,7 @@
// class multimap
-// void insert(initializer_list<value_type> il);
+// void insert(initializer_list<value_type> il); // constexpr since C++26
#include <map>
#include <cassert>
@@ -20,7 +20,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double> C;
typedef C::value_type V;
@@ -66,5 +67,14 @@ int main(int, char**) {
assert(*++i == V(3, 1.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/multimap/multimap.modifiers/insert_iter_cv.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp
index ef47d841775d3..22b6724dd165c 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_cv.pass.cpp
@@ -10,7 +10,7 @@
// class multimap
-// iterator insert(const_iterator position, const value_type& v);
+// iterator insert(const_iterator position, const value_type& v); // constexpr since C++26
#include <map>
#include <cassert>
@@ -19,7 +19,7 @@
#include "min_allocator.h"
template <class Container>
-void do_insert_hint_test() {
+TEST_CONSTEXPR_CXX26 void do_insert_hint_test() {
typedef Container M;
typedef typename M::iterator R;
typedef typename M::value_type VT;
@@ -53,7 +53,8 @@ void do_insert_hint_test() {
assert(r->second == 4.5);
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
do_insert_hint_test<std::multimap<int, double> >();
#if TEST_STD_VER >= 11
{
@@ -62,5 +63,14 @@ 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/multimap/multimap.modifiers/insert_iter_iter.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_iter.pass.cpp
index 3f145cc81ff46..7d776b3e086dd 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_iter.pass.cpp
@@ -11,7 +11,7 @@
// class multimap
// template <class InputIterator>
-// void insert(InputIterator first, InputIterator last);
+// void insert(InputIterator first, InputIterator last); // constexpr since C++26
#include <array>
#include <cassert>
@@ -22,7 +22,7 @@
#include "test_macros.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::multimap<int, int, std::less<int>, Alloc>;
@@ -195,13 +195,18 @@ void test_alloc() {
}
}
-void test() {
+TEST_CONSTEXPR_CXX26
+bool test() {
test_alloc<cpp17_input_iterator<std::pair<const int, int>*>, std::allocator<std::pair<const int, int> > >();
test_alloc<cpp17_input_iterator<std::pair<const int, int>*>, min_allocator<std::pair<const int, 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/multimap/multimap.modifiers/insert_iter_rv.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp
index a56f237eb63ac..507d5086623b3 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp
@@ -13,7 +13,7 @@
// class multimap
// template <class P>
-// iterator insert(const_iterator position, P&& p);
+// iterator insert(const_iterator position, P&& p); // constexpr since C++26
#include <map>
#include <cassert>
@@ -23,7 +23,7 @@
#include "test_macros.h"
template <class Container, class Pair>
-void do_insert_rv_test() {
+TEST_CONSTEXPR_CXX26 void do_insert_rv_test() {
typedef Container M;
typedef Pair P;
typedef typename M::iterator R;
@@ -53,7 +53,8 @@ void do_insert_rv_test() {
assert(r->second == 2);
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
do_insert_rv_test<std::multimap<int, MoveOnly>, std::pair<int, MoveOnly> >();
do_insert_rv_test<std::multimap<int, MoveOnly>, std::pair<const int, MoveOnly> >();
@@ -93,5 +94,14 @@ int main(int, char**) {
assert(r->second == 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/multimap/multimap.modifiers/insert_node_type.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_node_type.pass.cpp
index a488bc6617ccb..f68ffef47f48b 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_node_type.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_node_type.pass.cpp
@@ -12,7 +12,7 @@
// class multimap
-// iterator insert(node_type&&);
+// iterator insert(node_type&&); // constexpr since C++26
#include <map>
#include <type_traits>
@@ -20,19 +20,19 @@
#include "min_allocator.h"
template <class Container>
-typename Container::node_type
-node_factory(typename Container::key_type const& key, typename Container::mapped_type const& mapped) {
- static Container c;
+TEST_CONSTEXPR_CXX26 typename Container::node_type
+node_factory(Container& c, typename Container::key_type const& key, typename Container::mapped_type const& mapped) {
auto it = c.insert({key, mapped});
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, i + 1);
+ typename Container::node_type node = nf(c2, i, i + 1);
assert(!node.empty());
typename Container::iterator it = c.insert(std::move(node));
assert(node.empty());
@@ -49,7 +49,7 @@ void test(Container& c) {
}
{ // Insert duplicate node.
- typename Container::node_type dupl = nf(0, 42);
+ typename Container::node_type dupl = nf(c2, 0, 42);
auto it = c.insert(std::move(dupl));
assert(dupl.empty());
assert(it != c.end());
@@ -64,11 +64,21 @@ void test(Container& c) {
}
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
std::multimap<int, int> m;
test(m);
std::multimap<int, int, std::less<int>, min_allocator<std::pair<const int, 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/multimap/multimap.modifiers/insert_node_type_hint.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_node_type_hint.pass.cpp
index 7e855801045b8..e5b5c9dd5b371 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_node_type_hint.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_node_type_hint.pass.cpp
@@ -12,26 +12,26 @@
// class multimap
-// iterator insert(const_iterator hint, node_type&&);
+// iterator insert(const_iterator hint, node_type&&); // constexpr since C++26
#include <map>
#include "test_macros.h"
#include "min_allocator.h"
template <class Container>
-typename Container::node_type
-node_factory(typename Container::key_type const& key, typename Container::mapped_type const& mapped) {
- static Container c;
+TEST_CONSTEXPR_CXX26 typename Container::node_type
+node_factory(Container& c, typename Container::key_type const& key, typename Container::mapped_type const& mapped) {
auto it = c.insert({key, mapped});
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, i + 1);
+ typename Container::node_type node = nf(c2, i, i + 1);
assert(!node.empty());
std::size_t prev = c.size();
auto it = c.insert(c.end(), std::move(node));
@@ -50,11 +50,21 @@ void test(Container& c) {
}
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
std::multimap<int, int> m;
test(m);
std::multimap<int, int, std::less<int>, min_allocator<std::pair<const int, 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/multimap/multimap.modifiers/insert_range.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_range.pass.cpp
index efd257a4f2c0e..8d51b80df7bfd 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_range.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_range.pass.cpp
@@ -9,18 +9,21 @@
// 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=2147483647
+// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-ops-limit): -fconstexpr-ops-limit=800000000
// <map>
// 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 <map>
#include "../../../insert_range_maps_sets.h"
#include "test_macros.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
// Note: we want to use a pair with non-const elements for input (an assignable type is a lot more convenient) but
// have to use the exact `value_type` of the map (that is, `pair<const K, V>`) for the allocator.
using Pair = std::pair<int, char>;
@@ -37,5 +40,14 @@ int main(int, char**) {
test_map_insert_range_exception_safety_throwing_copy<std::multimap>();
test_assoc_map_insert_range_exception_safety_throwing_allocator<std::multimap, int, 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/multimap/multimap.modifiers/insert_rv.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp
index bf32b996e1836..dbb48cf14e260 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp
@@ -13,7 +13,7 @@
// class multimap
// template <class P>
-// iterator insert(P&& p);
+// iterator insert(P&& p); // constexpr since C++26
#include <map>
#include <cassert>
@@ -23,7 +23,7 @@
#include "test_macros.h"
template <class Container>
-void do_insert_rv_test() {
+TEST_CONSTEXPR_CXX26 void do_insert_rv_test() {
typedef std::multimap<int, MoveOnly> M;
typedef typename M::iterator R;
typedef typename M::value_type VT;
@@ -53,7 +53,8 @@ void do_insert_rv_test() {
assert(r->second == 3);
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
do_insert_rv_test<std::multimap<int, MoveOnly>>();
{
typedef std::multimap<int, MoveOnly, std::less<int>, min_allocator<std::pair<const int, MoveOnly>>> M;
@@ -88,5 +89,14 @@ int main(int, char**) {
assert(r->second == 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/multimap/multimap.modifiers/merge.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/merge.pass.cpp
index d7952763ca9bb..8adea46f339f2 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.modifiers/merge.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.modifiers/merge.pass.cpp
@@ -13,13 +13,13 @@
// class multimap
// template <class C2>
-// void merge(map<key_type, value_type, C2, allocator_type>& source);
+// void merge(map<key_type, value_type, C2, allocator_type>& source); // constexpr since C++26
// template <class C2>
-// void merge(map<key_type, value_type, C2, allocator_type>&& source);
+// void merge(map<key_type, value_type, C2, allocator_type>&& source); // constexpr since C++26
// template <class C2>
-// void merge(multimap<key_type, value_type, C2, allocator_type>& source);
+// void merge(multimap<key_type, value_type, C2, allocator_type>& source); // constexpr since C++26
// template <class C2>
-// void merge(multimap<key_type, value_type, C2, allocator_type>&& source);
+// void merge(multimap<key_type, value_type, C2, allocator_type>&& source); // constexpr since C++26
#include <map>
#include <cassert>
@@ -27,7 +27,7 @@
#include "Counter.h"
template <class Map>
-bool map_equal(const Map& map, Map other) {
+TEST_CONSTEXPR_CXX26 bool map_equal(const Map& map, Map other) {
return map == other;
}
@@ -46,7 +46,8 @@ struct throw_comparator {
};
#endif
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
std::multimap<int, int> src{{1, 0}, {3, 0}, {5, 0}};
std::multimap<int, int> dst{{2, 0}, {4, 0}, {5, 0}};
@@ -56,7 +57,7 @@ int main(int, char**) {
}
#ifndef TEST_HAS_NO_EXCEPTIONS
- {
+ if (!TEST_IS_CONSTANT_EVALUATED) {
bool do_throw = false;
typedef std::multimap<Counter<int>, int, throw_comparator> map_type;
map_type src({{1, 0}, {3, 0}, {5, 0}}, throw_comparator(do_throw));
@@ -75,13 +76,14 @@ int main(int, char**) {
assert(map_equal(dst, map_type({{2, 0}, {4, 0}, {5, 0}}, 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::multimap<Counter<int>, int, std::less<Counter<int>>> first_map_type;
typedef std::multimap<Counter<int>, int, comparator> second_map_type;
typedef std::map<Counter<int>, int, comparator> third_map_type;
@@ -121,7 +123,8 @@ int main(int, char**) {
}
assert(Counter_base::gConstructed == 0);
}
- assert(Counter_base::gConstructed == 0);
+ if (!TEST_IS_CONSTANT_EVALUATED)
+ assert(Counter_base::gConstructed == 0);
{
std::multimap<int, int> first;
{
@@ -135,5 +138,15 @@ 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/multimap/multimap.nonmember/compare.three_way.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.nonmember/compare.three_way.pass.cpp
index c7febc362cd63..498093fb15d9d 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.nonmember/compare.three_way.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.nonmember/compare.three_way.pass.cpp
@@ -14,15 +14,26 @@
// template<class Key, class T, class Compare, class Allocator>
// synth-three-way-result<pair<const Key, T>>
// operator<=>(const multimap<Key, T, Compare, Allocator>& x,
-// const multimap<Key, T, Compare, Allocator>& y);
+// const multimap<Key, T, Compare, Allocator>& y); // constexpr since C++26
#include <cassert>
#include <map>
#include "test_container_comparisons.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
assert(test_ordered_map_container_spaceship<std::multimap>());
// `std::multimap` 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/multimap/multimap.nonmember/op_compare.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.nonmember/op_compare.pass.cpp
index fe5f401e19b5c..e542f40c75e70 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.nonmember/op_compare.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.nonmember/op_compare.pass.cpp
@@ -10,27 +10,27 @@
// template<class Key, class T, class Compare, class Alloc>
// bool operator==(const std::multimap<Key, T, Compare, Alloc>& lhs,
-// const std::multimap<Key, T, Compare, Alloc>& rhs);
+// const std::multimap<Key, T, Compare, Alloc>& rhs); // constexpr since C++26
//
// template<class Key, class T, class Compare, class Alloc>
// bool operator!=(const std::multimap<Key, T, Compare, Alloc>& lhs,
-// const std::multimap<Key, T, Compare, Alloc>& rhs);
+// const std::multimap<Key, T, Compare, Alloc>& rhs); // constexpr since C++26
//
// template<class Key, class T, class Compare, class Alloc>
// bool operator<(const std::multimap<Key, T, Compare, Alloc>& lhs,
-// const std::multimap<Key, T, Compare, Alloc>& rhs);
+// const std::multimap<Key, T, Compare, Alloc>& rhs); // constexpr since C++26
//
// template<class Key, class T, class Compare, class Alloc>
// bool operator>(const std::multimap<Key, T, Compare, Alloc>& lhs,
-// const std::multimap<Key, T, Compare, Alloc>& rhs);
+// const std::multimap<Key, T, Compare, Alloc>& rhs); // constexpr since C++26
//
// template<class Key, class T, class Compare, class Alloc>
// bool operator<=(const std::multimap<Key, T, Compare, Alloc>& lhs,
-// const std::multimap<Key, T, Compare, Alloc>& rhs);
+// const std::multimap<Key, T, Compare, Alloc>& rhs); // constexpr since C++26
//
// template<class Key, class T, class Compare, class Alloc>
// bool operator>=(const std::multimap<Key, T, Compare, Alloc>& lhs,
-// const std::multimap<Key, T, Compare, Alloc>& rhs);
+// const std::multimap<Key, T, Compare, Alloc>& rhs); // constexpr since C++26
#include <map>
#include <cassert>
@@ -38,7 +38,8 @@
#include "test_comparisons.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::multimap<int, std::string> map_type;
typedef map_type::value_type value_type;
{
@@ -86,5 +87,15 @@ int main(int, char**) {
const map_type &cm1 = m1, cm2 = m2;
assert(testComparisons(cm1, cm2, 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/multimap/multimap.observers/key_comp.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.observers/key_comp.pass.cpp
index 29cdecd6fef48..6af4b1729d748 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.observers/key_comp.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.observers/key_comp.pass.cpp
@@ -8,13 +8,16 @@
// <map>
-// key_compare key_comp() const;
+// key_compare key_comp() const; // constexpr since C++26
#include <map>
#include <cassert>
#include <string>
-int main(int, char**) {
+#include "test_macros.h"
+
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::multimap<int, std::string> map_type;
map_type m;
@@ -26,5 +29,14 @@ int main(int, char**) {
assert(cm.key_comp()(i1->first, i2->first));
assert(!cm.key_comp()(i2->first, i1->first));
+ 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/multimap/multimap.observers/value_comp.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.observers/value_comp.pass.cpp
index 542ed6d71c8d1..d48309b579225 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.observers/value_comp.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.observers/value_comp.pass.cpp
@@ -8,13 +8,16 @@
// <map>
-// value_compare value_comp() const;
+// value_compare value_comp() const; // constexpr since C++26
#include <map>
#include <cassert>
#include <string>
-int main(int, char**) {
+#include "test_macros.h"
+
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::multimap<int, std::string> map_type;
map_type m;
@@ -26,5 +29,14 @@ int main(int, char**) {
assert(cm.value_comp()(*i1, *i2));
assert(!cm.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/multimap/multimap.ops/count.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp
index 8dfda74577e35..a532277ec4985 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/count.pass.cpp
@@ -10,7 +10,7 @@
// class multimap
-// size_type count(const key_type& k) const;
+// size_type count(const key_type& k) const; // constexpr since C++26
#include <map>
#include <cassert>
@@ -20,7 +20,8 @@
#include "private_constructor.h"
#include "is_transparent.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::pair<const int, double> V;
{
typedef std::multimap<int, double> M;
@@ -139,5 +140,14 @@ 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/multimap/multimap.ops/count0.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp
index 36f0ac2647ba3..8ffbe453b9837 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp
@@ -12,7 +12,7 @@
// class multimap
-// size_type count(const key_type& k) const;
+// size_type count(const key_type& k) const; // constexpr since C++26
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
@@ -24,7 +24,8 @@
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double, transparent_less> M;
assert(M().count(C2Int{5}) == 0);
@@ -38,5 +39,14 @@ int main(int, char**) {
assert(M().count(C2Int{5}) == 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/multimap/multimap.ops/count_transparent.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/count_transparent.pass.cpp
index d8dc81884388e..99d323eacdd5e 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/count_transparent.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/count_transparent.pass.cpp
@@ -13,27 +13,42 @@
// class multimap
// 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 <map>
#include <utility>
+#include "test_macros.h"
+
struct Comp {
using is_transparent = void;
+ TEST_CONSTEXPR_CXX26
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, int rhs) const { return lhs.first < rhs; }
+ 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::multimap<std::pair<int, int>, int, Comp> s{{{2, 1}, 1}, {{1, 1}, 2}, {{1, 1}, 3}, {{1, 1}, 4}, {{2, 2}, 5}};
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/multimap/multimap.ops/equal_range.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp
index d06a04e40c6b0..9a9c8123b9e7b 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range.pass.cpp
@@ -10,8 +10,8 @@
// class multimap
-// 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 <map>
#include <cassert>
@@ -21,7 +21,8 @@
#include "private_constructor.h"
#include "is_transparent.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::pair<const int, double> V;
{
typedef std::multimap<int, double> M;
@@ -228,5 +229,14 @@ 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/multimap/multimap.ops/equal_range0.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp
index a362c03e26385..2a7511984f1c6 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp
@@ -12,8 +12,8 @@
// class multimap
-// 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
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
@@ -25,7 +25,8 @@
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double, transparent_less> M;
typedef std::pair<typename M::iterator, typename M::iterator> P;
@@ -48,5 +49,14 @@ int main(int, char**) {
assert(result.first == result.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/multimap/multimap.ops/equal_range_transparent.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range_transparent.pass.cpp
index f2caf36b1a4ee..1e3c801b54773 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range_transparent.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/equal_range_transparent.pass.cpp
@@ -13,26 +13,31 @@
// class multimap
// template<typename K>
-// pair<iterator,iterator> equal_range(const K& x); // C++14
+// pair<iterator,iterator> equal_range(const K& x); // C++14, constexpr since C++26
// template<typename K>
-// pair<const_iterator,const_iterator> equal_range(const K& x) const;
-// // C++14
+// pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14, constexpr since C++26
#include <cassert>
#include <map>
#include <utility>
+#include "test_macros.h"
+
struct Comp {
using is_transparent = void;
+ TEST_CONSTEXPR_CXX26
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, int rhs) const { return lhs.first < rhs; }
+ 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::multimap<std::pair<int, int>, int, Comp> s{{{2, 1}, 1}, {{1, 1}, 2}, {{1, 1}, 3}, {{1, 1}, 4}, {{2, 2}, 5}};
auto er = s.equal_range(1);
@@ -45,5 +50,14 @@ 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/multimap/multimap.ops/find.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp
index 7939e77da308d..973a0a9d7e45b 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/find.pass.cpp
@@ -10,8 +10,8 @@
// class multimap
-// 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 <map>
#include <cassert>
@@ -22,7 +22,7 @@
#include "is_transparent.h"
template <class Iter>
-bool iter_in_range(Iter first, Iter last, Iter to_find) {
+TEST_CONSTEXPR_CXX26 bool iter_in_range(Iter first, Iter last, Iter to_find) {
for (; first != last; ++first) {
if (first == to_find)
return true;
@@ -30,7 +30,8 @@ bool iter_in_range(Iter first, Iter last, Iter to_find) {
return false;
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::pair<const int, double> V;
{
typedef std::multimap<int, double> M;
@@ -186,5 +187,14 @@ 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/multimap/multimap.ops/find0.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp
index ccb0900e76835..038c3b7bef6df 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp
@@ -12,8 +12,8 @@
// class multimap
-// 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
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
@@ -25,7 +25,8 @@
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double, transparent_less> M;
M example;
@@ -42,5 +43,14 @@ int main(int, char**) {
assert(example.find(C2Int{5}) == example.end());
}
+ 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/multimap/multimap.ops/lower_bound.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp
index 704cfff775884..2dc6c4c96ecfd 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound.pass.cpp
@@ -10,8 +10,8 @@
// class multimap
-// 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 <map>
#include <cassert>
@@ -21,7 +21,8 @@
#include "private_constructor.h"
#include "is_transparent.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::pair<const int, double> V;
{
typedef std::multimap<int, double> M;
@@ -178,5 +179,14 @@ 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/multimap/multimap.ops/lower_bound0.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp
index 4b4853062001f..8e1d918991483 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp
@@ -12,8 +12,8 @@
// class multimap
-// 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
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
@@ -25,7 +25,8 @@
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double, transparent_less> M;
M example;
@@ -42,5 +43,14 @@ int main(int, char**) {
assert(example.lower_bound(C2Int{5}) == example.end());
}
+ 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/multimap/multimap.ops/upper_bound.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp
index 164cfc7c88ac9..cdc762b368ab5 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound.pass.cpp
@@ -10,8 +10,8 @@
// class multimap
-// 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 <map>
#include <cassert>
@@ -21,7 +21,8 @@
#include "private_constructor.h"
#include "is_transparent.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::pair<const int, double> V;
{
typedef std::multimap<int, double> M;
@@ -177,5 +178,14 @@ 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/multimap/multimap.ops/upper_bound0.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp
index f2ae94577b6c1..fd06f56961ec0 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp
@@ -12,8 +12,8 @@
// class multimap
-// 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
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
@@ -25,7 +25,8 @@
#include "test_macros.h"
#include "is_transparent.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double, transparent_less> M;
M example;
@@ -42,5 +43,14 @@ int main(int, char**) {
assert(example.upper_bound(C2Int{5}) == example.end());
}
+ 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/multimap/multimap.special/member_swap.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.special/member_swap.pass.cpp
index e3ebe7980dd52..5a4e30462c5b1 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.special/member_swap.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.special/member_swap.pass.cpp
@@ -10,7 +10,7 @@
// class multimap
-// void swap(multimap& m);
+// void swap(multimap& m); // constexpr since C++26
#include <map>
#include <cassert>
@@ -18,7 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::pair<const int, double> V;
{
typedef std::multimap<int, double> M;
@@ -109,5 +110,14 @@ 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/multimap/multimap.special/non_member_swap.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp
index 7e771c9a034d9..cdb1bc6121bf0 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp
@@ -12,7 +12,7 @@
// template <class Key, class T, class Compare, class Allocator>
// void
-// swap(multimap<Key, T, Compare, Allocator>& x, multimap<Key, T, Compare, Allocator>& y);
+// swap(multimap<Key, T, Compare, Allocator>& x, multimap<Key, T, Compare, Allocator>& y); // constexpr since C++26
#include <map>
#include <cassert>
@@ -21,7 +21,8 @@
#include "../../../test_compare.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::pair<const int, double> V;
{
typedef std::multimap<int, double> M;
@@ -166,5 +167,14 @@ 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/multimap/multimap.special/swap_noexcept.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp
index cc8af8bf3a30f..1fde434448732 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.special/swap_noexcept.pass.cpp
@@ -16,7 +16,7 @@
//
// 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,8 @@ struct some_alloc3 {
typedef std::false_type is_always_equal;
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::pair<const MoveOnly, MoveOnly> V;
{
typedef std::multimap<MoveOnly, MoveOnly> C;
@@ -132,5 +133,14 @@ 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/multimap/multimap.value_compare/invoke.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.value_compare/invoke.pass.cpp
index 67b4743097da8..675e8a1257fb3 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.value_compare/invoke.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.value_compare/invoke.pass.cpp
@@ -10,24 +10,29 @@
// class value_compare
-// bool operator()( const value_type& lhs, const value_type& rhs ) const;
+// bool operator()( const value_type& lhs, const value_type& rhs ) const; // constexpr since C++26
#include <map>
#include <cassert>
#include <string>
#include <utility>
+#include "test_macros.h"
+
template <typename MMap>
struct CallCompMember : MMap::value_compare {
+ TEST_CONSTEXPR_CXX26
CallCompMember(const typename MMap::value_compare& vc) : MMap::value_compare(vc) {}
typedef typename MMap::value_type value_type;
+ TEST_CONSTEXPR_CXX26
bool operator()(const value_type& value1, const value_type& value2) const {
return this->comp(value1.first, value2.first);
}
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::multimap<int, std::string> map_type;
map_type m;
@@ -43,5 +48,14 @@ int main(int, char**) {
assert(!vc(*i2, *i1));
assert(!call_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/multimap/multimap.value_compare/types.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.value_compare/types.pass.cpp
index bd1165e61aa9b..bf9d01614019e 100644
--- a/libcxx/test/std/containers/associative/multimap/multimap.value_compare/types.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/multimap.value_compare/types.pass.cpp
@@ -17,7 +17,8 @@
#include "test_macros.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
typedef std::multimap<int, std::string> map_type;
typedef map_type::value_compare value_compare;
typedef map_type::value_type value_type;
@@ -26,5 +27,14 @@ int main(int, char**) {
ASSERT_SAME_TYPE(value_compare::first_argument_type, value_type);
ASSERT_SAME_TYPE(value_compare::second_argument_type, value_type);
+ 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/multimap/size.pass.cpp b/libcxx/test/std/containers/associative/multimap/size.pass.cpp
index 77bd807db6b10..bedc08c36945c 100644
--- a/libcxx/test/std/containers/associative/multimap/size.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/size.pass.cpp
@@ -10,7 +10,7 @@
// class multimap
-// size_type size() const;
+// size_type size() const; // constexpr since C++26
#include <map>
#include <cassert>
@@ -18,7 +18,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double> M;
M m;
@@ -56,5 +57,14 @@ 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/multimap/types.pass.cpp b/libcxx/test/std/containers/associative/multimap/types.pass.cpp
index 2b182c36c1a7d..0f2d6190c1fc5 100644
--- a/libcxx/test/std/containers/associative/multimap/types.pass.cpp
+++ b/libcxx/test/std/containers/associative/multimap/types.pass.cpp
@@ -34,7 +34,8 @@
#include "test_macros.h"
#include "min_allocator.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26
+bool test() {
{
typedef std::multimap<int, double> C;
static_assert((std::is_same<C::key_type, int>::value), "");
@@ -67,5 +68,14 @@ 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/container.node/node_handle.pass.cpp b/libcxx/test/std/containers/container.node/node_handle.pass.cpp
index c1477763e0afe..38c1f60a31c49 100644
--- a/libcxx/test/std/containers/container.node/node_handle.pass.cpp
+++ b/libcxx/test/std/containers/container.node/node_handle.pass.cpp
@@ -149,10 +149,10 @@ TEST_CONSTEXPR_CXX26 bool test_insert_return_type() {
TEST_CONSTEXPR_CXX26 bool test() {
test_node_handle_operations<std::map<int, int>>();
+ test_node_handle_operations_multi<std::multimap<int, int>>();
// FIXME: update when other containers are made constexpr
if (!TEST_IS_CONSTANT_EVALUATED) {
- test_node_handle_operations_multi<std::multimap<int, int>>();
test_node_handle_operations<std::set<int>>();
test_node_handle_operations_multi<std::multiset<int>>();
test_node_handle_operations<std::unordered_map<int, int>>();
More information about the libcxx-commits
mailing list