[libcxx-commits] [libcxx] 3e5fd77 - [libc++] constexpr priority_queue (#140634)
via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jun 4 04:58:29 PDT 2025
Author: Peng Liu
Date: 2025-06-04T19:58:25+08:00
New Revision: 3e5fd77d32a5061619091746197e83f0666ff6af
URL: https://github.com/llvm/llvm-project/commit/3e5fd77d32a5061619091746197e83f0666ff6af
DIFF: https://github.com/llvm/llvm-project/commit/3e5fd77d32a5061619091746197e83f0666ff6af.diff
LOG: [libc++] constexpr priority_queue (#140634)
This patch makes `priority_queue` constexpr as part of P3372R3.
Fixes #128671.
Added:
Modified:
libcxx/docs/FeatureTestMacroTable.rst
libcxx/include/queue
libcxx/include/version
libcxx/test/std/containers/Emplaceable.h
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_cont_alloc.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_rcont_alloc.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_copy_alloc.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_alloc.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_comp_alloc.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_comp_cont_alloc.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_comp_rcont_alloc.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_copy.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_container.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_copy.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_default.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_cont.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/empty.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/pop.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/push.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/size.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/swap.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/top.pass.cpp
libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap.pass.cpp
libcxx/test/std/language.support/support.limits/support.limits.general/queue.version.compile.pass.cpp
libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
libcxx/utils/generate_feature_test_macro_components.py
Removed:
################################################################################
diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst
index 9b57b7c8eeb52..a89d4038785cd 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -422,6 +422,8 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_constexpr_new`` ``202406L``
---------------------------------------------------------- -----------------
+ ``__cpp_lib_constexpr_queue`` ``202502L``
+ ---------------------------------------------------------- -----------------
``__cpp_lib_constrained_equality`` *unimplemented*
---------------------------------------------------------- -----------------
``__cpp_lib_copyable_function`` *unimplemented*
diff --git a/libcxx/include/queue b/libcxx/include/queue
index 7043a84390d02..c33afc892dda8 100644
--- a/libcxx/include/queue
+++ b/libcxx/include/queue
@@ -458,14 +458,12 @@ template <class _InputIterator,
class _Alloc,
__enable_if_t<__has_input_iterator_category<_InputIterator>::value, int> = 0,
__enable_if_t<__is_allocator<_Alloc>::value, int> = 0>
-queue(_InputIterator,
- _InputIterator,
- _Alloc) -> queue<__iter_value_type<_InputIterator>, deque<__iter_value_type<_InputIterator>, _Alloc>>;
+queue(_InputIterator, _InputIterator, _Alloc)
+ -> queue<__iter_value_type<_InputIterator>, deque<__iter_value_type<_InputIterator>, _Alloc>>;
template <ranges::input_range _Range, class _Alloc, __enable_if_t<__is_allocator<_Alloc>::value, int> = 0>
-queue(from_range_t,
- _Range&&,
- _Alloc) -> queue<ranges::range_value_t<_Range>, deque<ranges::range_value_t<_Range>, _Alloc>>;
+queue(from_range_t, _Range&&, _Alloc)
+ -> queue<ranges::range_value_t<_Range>, deque<ranges::range_value_t<_Range>, _Alloc>>;
# endif
template <class _Tp, class _Container>
@@ -533,24 +531,25 @@ protected:
value_compare comp;
public:
- _LIBCPP_HIDE_FROM_ABI priority_queue() _NOEXCEPT_(
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI priority_queue() _NOEXCEPT_(
is_nothrow_default_constructible<container_type>::value&& is_nothrow_default_constructible<value_compare>::value)
: c(), comp() {}
- _LIBCPP_HIDE_FROM_ABI priority_queue(const priority_queue& __q) : c(__q.c), comp(__q.comp) {}
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI priority_queue(const priority_queue& __q)
+ : c(__q.c), comp(__q.comp) {}
- _LIBCPP_HIDE_FROM_ABI priority_queue& operator=(const priority_queue& __q) {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI priority_queue& operator=(const priority_queue& __q) {
c = __q.c;
comp = __q.comp;
return *this;
}
# ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI priority_queue(priority_queue&& __q) noexcept(
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI priority_queue(priority_queue&& __q) noexcept(
is_nothrow_move_constructible<container_type>::value && is_nothrow_move_constructible<value_compare>::value)
: c(std::move(__q.c)), comp(std::move(__q.comp)) {}
- _LIBCPP_HIDE_FROM_ABI priority_queue& operator=(priority_queue&& __q) noexcept(
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI priority_queue& operator=(priority_queue&& __q) noexcept(
is_nothrow_move_assignable<container_type>::value && is_nothrow_move_assignable<value_compare>::value) {
c = std::move(__q.c);
comp = std::move(__q.comp);
@@ -558,50 +557,56 @@ public:
}
# endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI explicit priority_queue(const value_compare& __comp) : c(), comp(__comp) {}
- _LIBCPP_HIDE_FROM_ABI priority_queue(const value_compare& __comp, const container_type& __c);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit priority_queue(const value_compare& __comp)
+ : c(), comp(__comp) {}
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI
+ priority_queue(const value_compare& __comp, const container_type& __c);
# ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI priority_queue(const value_compare& __comp, container_type&& __c);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI priority_queue(const value_compare& __comp, container_type&& __c);
# endif
template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp = value_compare());
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI
+ priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp = value_compare());
template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI
priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp, const container_type& __c);
# ifndef _LIBCPP_CXX03_LANG
template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI
priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp, container_type&& __c);
# endif // _LIBCPP_CXX03_LANG
# if _LIBCPP_STD_VER >= 23
template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI priority_queue(from_range_t, _Range&& __range, const value_compare& __comp = value_compare())
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI
+ priority_queue(from_range_t, _Range&& __range, const value_compare& __comp = value_compare())
: c(from_range, std::forward<_Range>(__range)), comp(__comp) {
std::make_heap(c.begin(), c.end(), comp);
}
# endif
template <class _Alloc, __enable_if_t<uses_allocator<container_type, _Alloc>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI explicit priority_queue(const _Alloc& __a);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI explicit priority_queue(const _Alloc& __a);
template <class _Alloc, __enable_if_t<uses_allocator<container_type, _Alloc>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI priority_queue(const value_compare& __comp, const _Alloc& __a);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI priority_queue(const value_compare& __comp, const _Alloc& __a);
template <class _Alloc, __enable_if_t<uses_allocator<container_type, _Alloc>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI priority_queue(const value_compare& __comp, const container_type& __c, const _Alloc& __a);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI
+ priority_queue(const value_compare& __comp, const container_type& __c, const _Alloc& __a);
template <class _Alloc, __enable_if_t<uses_allocator<container_type, _Alloc>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI priority_queue(const priority_queue& __q, const _Alloc& __a);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI priority_queue(const priority_queue& __q, const _Alloc& __a);
# ifndef _LIBCPP_CXX03_LANG
template <class _Alloc, __enable_if_t<uses_allocator<container_type, _Alloc>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI priority_queue(const value_compare& __comp, container_type&& __c, const _Alloc& __a);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI
+ priority_queue(const value_compare& __comp, container_type&& __c, const _Alloc& __a);
template <class _Alloc, __enable_if_t<uses_allocator<container_type, _Alloc>::value, int> = 0>
- _LIBCPP_HIDE_FROM_ABI priority_queue(priority_queue&& __q, const _Alloc& __a);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI priority_queue(priority_queue&& __q, const _Alloc& __a);
# endif // _LIBCPP_CXX03_LANG
template <
@@ -609,21 +614,22 @@ public:
class _Alloc,
__enable_if_t<__has_input_iterator_category<_InputIter>::value && uses_allocator<container_type, _Alloc>::value,
int> = 0>
- _LIBCPP_HIDE_FROM_ABI priority_queue(_InputIter __f, _InputIter __l, const _Alloc& __a);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI priority_queue(_InputIter __f, _InputIter __l, const _Alloc& __a);
template <
class _InputIter,
class _Alloc,
__enable_if_t<__has_input_iterator_category<_InputIter>::value && uses_allocator<container_type, _Alloc>::value,
int> = 0>
- _LIBCPP_HIDE_FROM_ABI priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp, const _Alloc& __a);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI
+ priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp, const _Alloc& __a);
template <
class _InputIter,
class _Alloc,
__enable_if_t<__has_input_iterator_category<_InputIter>::value && uses_allocator<container_type, _Alloc>::value,
int> = 0>
- _LIBCPP_HIDE_FROM_ABI priority_queue(
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI priority_queue(
_InputIter __f, _InputIter __l, const value_compare& __comp, const container_type& __c, const _Alloc& __a);
# ifndef _LIBCPP_CXX03_LANG
@@ -632,7 +638,7 @@ public:
class _Alloc,
__enable_if_t<__has_input_iterator_category<_InputIter>::value && uses_allocator<container_type, _Alloc>::value,
int> = 0>
- _LIBCPP_HIDE_FROM_ABI
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI
priority_queue(_InputIter __f, _InputIter __l, const value_compare& __comp, container_type&& __c, const _Alloc& __a);
# endif // _LIBCPP_CXX03_LANG
@@ -641,7 +647,8 @@ public:
template <_ContainerCompatibleRange<_Tp> _Range,
class _Alloc,
class = enable_if_t<uses_allocator<_Container, _Alloc>::value>>
- _LIBCPP_HIDE_FROM_ABI priority_queue(from_range_t, _Range&& __range, const value_compare& __comp, const _Alloc& __a)
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI
+ priority_queue(from_range_t, _Range&& __range, const value_compare& __comp, const _Alloc& __a)
: c(from_range, std::forward<_Range>(__range), __a), comp(__comp) {
std::make_heap(c.begin(), c.end(), comp);
}
@@ -649,24 +656,24 @@ public:
template <_ContainerCompatibleRange<_Tp> _Range,
class _Alloc,
class = enable_if_t<uses_allocator<_Container, _Alloc>::value>>
- _LIBCPP_HIDE_FROM_ABI priority_queue(from_range_t, _Range&& __range, const _Alloc& __a)
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI priority_queue(from_range_t, _Range&& __range, const _Alloc& __a)
: c(from_range, std::forward<_Range>(__range), __a), comp() {
std::make_heap(c.begin(), c.end(), comp);
}
# endif
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI bool empty() const { return c.empty(); }
- _LIBCPP_HIDE_FROM_ABI size_type size() const { return c.size(); }
- _LIBCPP_HIDE_FROM_ABI const_reference top() const { return c.front(); }
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI bool empty() const { return c.empty(); }
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI size_type size() const { return c.size(); }
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const_reference top() const { return c.front(); }
- _LIBCPP_HIDE_FROM_ABI void push(const value_type& __v);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void push(const value_type& __v);
# ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI void push(value_type&& __v);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void push(value_type&& __v);
# if _LIBCPP_STD_VER >= 23
template <_ContainerCompatibleRange<_Tp> _Range>
- _LIBCPP_HIDE_FROM_ABI void push_range(_Range&& __range) {
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void push_range(_Range&& __range) {
if constexpr (requires(container_type& __c) { __c.append_range(std::forward<_Range>(__range)); }) {
c.append_range(std::forward<_Range>(__range));
} else {
@@ -678,14 +685,16 @@ public:
# endif
template <class... _Args>
- _LIBCPP_HIDE_FROM_ABI void emplace(_Args&&... __args);
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void emplace(_Args&&... __args);
# endif // _LIBCPP_CXX03_LANG
- _LIBCPP_HIDE_FROM_ABI void pop();
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void pop();
- _LIBCPP_HIDE_FROM_ABI void swap(priority_queue& __q)
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI void swap(priority_queue& __q)
_NOEXCEPT_(__is_nothrow_swappable_v<container_type>&& __is_nothrow_swappable_v<value_compare>);
- [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const { return c; }
+ [[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX26 _LIBCPP_HIDE_FROM_ABI const _Container& __get_container() const {
+ return c;
+ }
};
# if _LIBCPP_STD_VER >= 17
@@ -767,7 +776,8 @@ priority_queue(from_range_t, _Range&&, _Alloc)
# endif
template <class _Tp, class _Container, class _Compare>
-inline priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp, const container_type& __c)
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ const _Compare& __comp, const container_type& __c)
: c(__c), comp(__comp) {
std::make_heap(c.begin(), c.end(), comp);
}
@@ -775,7 +785,8 @@ inline priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare&
# ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
-inline priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp, container_type&& __c)
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ const value_compare& __comp, container_type&& __c)
: c(std::move(__c)), comp(__comp) {
std::make_heap(c.begin(), c.end(), comp);
}
@@ -784,7 +795,7 @@ inline priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_com
template <class _Tp, class _Container, class _Compare>
template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> >
-inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
_InputIter __f, _InputIter __l, const value_compare& __comp)
: c(__f, __l), comp(__comp) {
std::make_heap(c.begin(), c.end(), comp);
@@ -792,7 +803,7 @@ inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
template <class _Tp, class _Container, class _Compare>
template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> >
-inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
_InputIter __f, _InputIter __l, const value_compare& __comp, const container_type& __c)
: c(__c), comp(__comp) {
c.insert(c.end(), __f, __l);
@@ -803,7 +814,7 @@ inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
template <class _Tp, class _Container, class _Compare>
template <class _InputIter, __enable_if_t<__has_input_iterator_category<_InputIter>::value, int> >
-inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
_InputIter __f, _InputIter __l, const value_compare& __comp, container_type&& __c)
: c(std::move(__c)), comp(__comp) {
c.insert(c.end(), __f, __l);
@@ -814,16 +825,18 @@ inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
template <class _Tp, class _Container, class _Compare>
template <class _Alloc, __enable_if_t<uses_allocator<_Container, _Alloc>::value, int> >
-inline priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Alloc& __a) : c(__a) {}
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Alloc& __a)
+ : c(__a) {}
template <class _Tp, class _Container, class _Compare>
template <class _Alloc, __enable_if_t<uses_allocator<_Container, _Alloc>::value, int> >
-inline priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp, const _Alloc& __a)
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ const value_compare& __comp, const _Alloc& __a)
: c(__a), comp(__comp) {}
template <class _Tp, class _Container, class _Compare>
template <class _Alloc, __enable_if_t<uses_allocator<_Container, _Alloc>::value, int> >
-inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
const value_compare& __comp, const container_type& __c, const _Alloc& __a)
: c(__c, __a), comp(__comp) {
std::make_heap(c.begin(), c.end(), comp);
@@ -831,14 +844,15 @@ inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
template <class _Tp, class _Container, class _Compare>
template <class _Alloc, __enable_if_t<uses_allocator<_Container, _Alloc>::value, int> >
-inline priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue& __q, const _Alloc& __a)
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ const priority_queue& __q, const _Alloc& __a)
: c(__q.c, __a), comp(__q.comp) {}
# ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
template <class _Alloc, __enable_if_t<uses_allocator<_Container, _Alloc>::value, int> >
-inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
const value_compare& __comp, container_type&& __c, const _Alloc& __a)
: c(std::move(__c), __a), comp(__comp) {
std::make_heap(c.begin(), c.end(), comp);
@@ -846,7 +860,8 @@ inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
template <class _Tp, class _Container, class _Compare>
template <class _Alloc, __enable_if_t<uses_allocator<_Container, _Alloc>::value, int> >
-inline priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q, const _Alloc& __a)
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ priority_queue&& __q, const _Alloc& __a)
: c(std::move(__q.c), __a), comp(std::move(__q.comp)) {}
# endif // _LIBCPP_CXX03_LANG
@@ -856,7 +871,8 @@ template <
class _InputIter,
class _Alloc,
__enable_if_t<__has_input_iterator_category<_InputIter>::value && uses_allocator<_Container, _Alloc>::value, int> >
-inline priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l, const _Alloc& __a)
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+ _InputIter __f, _InputIter __l, const _Alloc& __a)
: c(__f, __l, __a), comp() {
std::make_heap(c.begin(), c.end(), comp);
}
@@ -866,7 +882,7 @@ template <
class _InputIter,
class _Alloc,
__enable_if_t<__has_input_iterator_category<_InputIter>::value && uses_allocator<_Container, _Alloc>::value, int> >
-inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
_InputIter __f, _InputIter __l, const value_compare& __comp, const _Alloc& __a)
: c(__f, __l, __a), comp(__comp) {
std::make_heap(c.begin(), c.end(), comp);
@@ -877,7 +893,7 @@ template <
class _InputIter,
class _Alloc,
__enable_if_t<__has_input_iterator_category<_InputIter>::value && uses_allocator<_Container, _Alloc>::value, int> >
-inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
_InputIter __f, _InputIter __l, const value_compare& __comp, const container_type& __c, const _Alloc& __a)
: c(__c, __a), comp(__comp) {
c.insert(c.end(), __f, __l);
@@ -890,7 +906,7 @@ template <
class _InputIter,
class _Alloc,
__enable_if_t<__has_input_iterator_category<_InputIter>::value && uses_allocator<_Container, _Alloc>::value, int> >
-inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
_InputIter __f, _InputIter __l, const value_compare& __comp, container_type&& __c, const _Alloc& __a)
: c(std::move(__c), __a), comp(__comp) {
c.insert(c.end(), __f, __l);
@@ -899,7 +915,7 @@ inline priority_queue<_Tp, _Container, _Compare>::priority_queue(
# endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
-inline void priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline void priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v) {
c.push_back(__v);
std::push_heap(c.begin(), c.end(), comp);
}
@@ -907,14 +923,14 @@ inline void priority_queue<_Tp, _Container, _Compare>::push(const value_type& __
# ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
-inline void priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline void priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v) {
c.push_back(std::move(__v));
std::push_heap(c.begin(), c.end(), comp);
}
template <class _Tp, class _Container, class _Compare>
template <class... _Args>
-inline void priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args) {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline void priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args) {
c.emplace_back(std::forward<_Args>(__args)...);
std::push_heap(c.begin(), c.end(), comp);
}
@@ -922,13 +938,13 @@ inline void priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args
# endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
-inline void priority_queue<_Tp, _Container, _Compare>::pop() {
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline void priority_queue<_Tp, _Container, _Compare>::pop() {
std::pop_heap(c.begin(), c.end(), comp);
c.pop_back();
}
template <class _Tp, class _Container, class _Compare>
-inline void priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q)
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline void priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q)
_NOEXCEPT_(__is_nothrow_swappable_v<container_type>&& __is_nothrow_swappable_v<value_compare>) {
using std::swap;
swap(c, __q.c);
@@ -939,7 +955,7 @@ template <class _Tp,
class _Container,
class _Compare,
__enable_if_t<__is_swappable_v<_Container> && __is_swappable_v<_Compare>, int> = 0>
-inline _LIBCPP_HIDE_FROM_ABI void
+_LIBCPP_CONSTEXPR_SINCE_CXX26 inline _LIBCPP_HIDE_FROM_ABI void
swap(priority_queue<_Tp, _Container, _Compare>& __x, priority_queue<_Tp, _Container, _Compare>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y))) {
__x.swap(__y);
diff --git a/libcxx/include/version b/libcxx/include/version
index 77d97b93adc6c..65fae111dc8ed 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -74,6 +74,7 @@ __cpp_lib_constexpr_memory 202202L <memory>
201811L // C++20
__cpp_lib_constexpr_new 202406L <new>
__cpp_lib_constexpr_numeric 201911L <numeric>
+__cpp_lib_constexpr_queue 202502L <queue>
__cpp_lib_constexpr_string 201907L <string>
__cpp_lib_constexpr_string_view 201811L <string_view>
__cpp_lib_constexpr_tuple 201811L <tuple>
@@ -545,6 +546,7 @@ __cpp_lib_void_t 201411L <type_traits>
# if !defined(_LIBCPP_ABI_VCRUNTIME)
# define __cpp_lib_constexpr_new 202406L
# endif
+# define __cpp_lib_constexpr_queue 202502L
// # define __cpp_lib_constrained_equality 202403L
// # define __cpp_lib_copyable_function 202306L
// # define __cpp_lib_debugging 202311L
diff --git a/libcxx/test/std/containers/Emplaceable.h b/libcxx/test/std/containers/Emplaceable.h
index afc4e2e38b0eb..246d5b255d6b1 100644
--- a/libcxx/test/std/containers/Emplaceable.h
+++ b/libcxx/test/std/containers/Emplaceable.h
@@ -15,20 +15,20 @@
#if TEST_STD_VER >= 11
class Emplaceable {
- Emplaceable(const Emplaceable&);
- Emplaceable& operator=(const Emplaceable&);
+ TEST_CONSTEXPR Emplaceable(const Emplaceable&);
+ TEST_CONSTEXPR_CXX14 Emplaceable& operator=(const Emplaceable&);
int int_;
double double_;
public:
- Emplaceable() : int_(0), double_(0) {}
- Emplaceable(int i, double d) : int_(i), double_(d) {}
- Emplaceable(Emplaceable&& x) : int_(x.int_), double_(x.double_) {
+ TEST_CONSTEXPR Emplaceable() : int_(0), double_(0) {}
+ TEST_CONSTEXPR Emplaceable(int i, double d) : int_(i), double_(d) {}
+ TEST_CONSTEXPR_CXX14 Emplaceable(Emplaceable&& x) : int_(x.int_), double_(x.double_) {
x.int_ = 0;
x.double_ = 0;
}
- Emplaceable& operator=(Emplaceable&& x) {
+ TEST_CONSTEXPR_CXX14 Emplaceable& operator=(Emplaceable&& x) {
int_ = x.int_;
x.int_ = 0;
double_ = x.double_;
@@ -36,10 +36,12 @@ class Emplaceable {
return *this;
}
- bool operator==(const Emplaceable& x) const { return int_ == x.int_ && double_ == x.double_; }
- bool operator<(const Emplaceable& x) const { return int_ < x.int_ || (int_ == x.int_ && double_ < x.double_); }
+ TEST_CONSTEXPR bool operator==(const Emplaceable& x) const { return int_ == x.int_ && double_ == x.double_; }
+ TEST_CONSTEXPR bool operator<(const Emplaceable& x) const {
+ return int_ < x.int_ || (int_ == x.int_ && double_ < x.double_);
+ }
- int get() const { return int_; }
+ TEST_CONSTEXPR int get() const { return int_; }
};
template <>
@@ -47,7 +49,7 @@ struct std::hash<Emplaceable> {
typedef Emplaceable argument_type;
typedef std::size_t result_type;
- std::size_t operator()(const Emplaceable& x) const { return static_cast<std::size_t>(x.get()); }
+ TEST_CONSTEXPR std::size_t operator()(const Emplaceable& x) const { return static_cast<std::size_t>(x.get()); }
};
#endif // TEST_STD_VER >= 11
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp
index 903a4ca2c2b4b..07d694fd399a3 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_alloc.pass.cpp
@@ -18,29 +18,38 @@
#include "test_allocator.h"
template <class T>
-struct test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
+struct Test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
typedef typename base::container_type container_type;
typedef typename base::value_compare value_compare;
- explicit test(const test_allocator<int>& a) : base(a) {}
- test(const value_compare& comp, const test_allocator<int>& a) : base(comp, c, a) {}
- test(const value_compare& comp, const container_type& container, const test_allocator<int>& a)
+ TEST_CONSTEXPR_CXX26 explicit Test(const test_allocator<int>& a) : base(a) {}
+ TEST_CONSTEXPR_CXX26 Test(const value_compare& comp, const test_allocator<int>& a) : base(comp, c, a) {}
+ TEST_CONSTEXPR_CXX26 Test(const value_compare& comp, const container_type& container, const test_allocator<int>& a)
: base(comp, container, a) {}
#if TEST_STD_VER >= 11
- test(const value_compare& comp, container_type&& container, const test_allocator<int>& a)
+ TEST_CONSTEXPR_CXX26 Test(const value_compare& comp, container_type&& container, const test_allocator<int>& a)
: base(comp, std::move(container), a) {}
- test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
+ TEST_CONSTEXPR_CXX26 Test(Test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
#endif
- test_allocator<int> get_allocator() { return c.get_allocator(); }
+ TEST_CONSTEXPR_CXX26 test_allocator<int> get_allocator() { return c.get_allocator(); }
using base::c;
};
-int main(int, char**) {
- test<int> q((test_allocator<int>(3)));
+TEST_CONSTEXPR_CXX26 bool test() {
+ Test<int> q((test_allocator<int>(3)));
assert(q.c.get_allocator() == test_allocator<int>(3));
assert(q.c.size() == 0);
+ return true;
+}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp
index 439b19377abab..cf2c5c46f5096 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_alloc.pass.cpp
@@ -18,29 +18,38 @@
#include "test_allocator.h"
template <class T>
-struct test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
+struct Test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
typedef typename base::container_type container_type;
typedef typename base::value_compare value_compare;
- explicit test(const test_allocator<int>& a) : base(a) {}
- test(const value_compare& compare, const test_allocator<int>& a) : base(compare, a) {}
- test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
+ TEST_CONSTEXPR_CXX26 explicit Test(const test_allocator<int>& a) : base(a) {}
+ TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, const test_allocator<int>& a) : base(compare, a) {}
+ TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
: base(compare, container, a) {}
#if TEST_STD_VER >= 11
- test(const value_compare& compare, container_type&& container, const test_allocator<int>& a)
+ TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, container_type&& container, const test_allocator<int>& a)
: base(compare, std::move(container), a) {}
- test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
+ TEST_CONSTEXPR_CXX26 Test(Test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
#endif
- test_allocator<int> get_allocator() { return c.get_allocator(); }
+ TEST_CONSTEXPR_CXX26 test_allocator<int> get_allocator() { return c.get_allocator(); }
using base::c;
};
-int main(int, char**) {
- test<int> q(std::less<int>(), test_allocator<int>(3));
+TEST_CONSTEXPR_CXX26 bool test() {
+ Test<int> q(std::less<int>(), test_allocator<int>(3));
assert(q.c.get_allocator() == test_allocator<int>(3));
assert(q.c.size() == 0);
- return 0;
+ return true;
}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
+ return 0;
+}
\ No newline at end of file
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_cont_alloc.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_cont_alloc.pass.cpp
index dddc11c88689b..653845a2b6d79 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_cont_alloc.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_cont_alloc.pass.cpp
@@ -19,7 +19,7 @@
#include "test_allocator.h"
template <class C>
-C make(int n) {
+TEST_CONSTEXPR_CXX26 C make(int n) {
C c;
for (int i = 0; i < n; ++i)
c.push_back(i);
@@ -27,32 +27,41 @@ C make(int n) {
}
template <class T>
-struct test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
+struct Test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
typedef typename base::container_type container_type;
typedef typename base::value_compare value_compare;
- explicit test(const test_allocator<int>& a) : base(a) {}
- test(const value_compare& compare, const test_allocator<int>& a) : base(compare, a) {}
- test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
+ TEST_CONSTEXPR_CXX26 explicit Test(const test_allocator<int>& a) : base(a) {}
+ TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, const test_allocator<int>& a) : base(compare, a) {}
+ TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
: base(compare, container, a) {}
#if TEST_STD_VER >= 11 // testing rvalue constructor
- test(const value_compare& compare, container_type&& container, const test_allocator<int>& a)
+ TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, container_type&& container, const test_allocator<int>& a)
: base(compare, std::move(container), a) {}
- test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
+ TEST_CONSTEXPR_CXX26 Test(Test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
#endif
- test_allocator<int> get_allocator() { return c.get_allocator(); }
+ TEST_CONSTEXPR_CXX26 test_allocator<int> get_allocator() { return c.get_allocator(); }
using base::c;
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
typedef std::vector<int, test_allocator<int> > C;
C v = make<C>(5);
- test<int> q(std::less<int>(), v, test_allocator<int>(3));
+ Test<int> q(std::less<int>(), v, test_allocator<int>(3));
assert(q.c.get_allocator() == test_allocator<int>(3));
assert(q.size() == 5);
assert(q.top() == 4);
+ return true;
+}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_rcont_alloc.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_rcont_alloc.pass.cpp
index bdb84a5f274da..1e1da8db85686 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_rcont_alloc.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_comp_rcont_alloc.pass.cpp
@@ -19,7 +19,7 @@
#include "test_allocator.h"
template <class C>
-C make(int n) {
+TEST_CONSTEXPR_CXX26 C make(int n) {
C c;
for (int i = 0; i < n; ++i)
c.push_back(i);
@@ -27,31 +27,40 @@ C make(int n) {
}
template <class T>
-struct test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
+struct Test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
typedef typename base::container_type container_type;
typedef typename base::value_compare value_compare;
- explicit test(const test_allocator<int>& a) : base(a) {}
- test(const value_compare& compare, const test_allocator<int>& a) : base(compare, a) {}
- test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
+ TEST_CONSTEXPR_CXX26 explicit Test(const test_allocator<int>& a) : base(a) {}
+ TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, const test_allocator<int>& a) : base(compare, a) {}
+ TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
: base(compare, container, a) {}
#if TEST_STD_VER >= 11 // testing rvalue ctor
- test(const value_compare& compare, container_type&& container, const test_allocator<int>& a)
+ TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, container_type&& container, const test_allocator<int>& a)
: base(compare, std::move(container), a) {}
- test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
+ TEST_CONSTEXPR_CXX26 Test(Test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
#endif
- test_allocator<int> get_allocator() { return c.get_allocator(); }
+ TEST_CONSTEXPR_CXX26 test_allocator<int> get_allocator() { return c.get_allocator(); }
using base::c;
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
typedef std::vector<int, test_allocator<int> > C;
- test<int> q(std::less<int>(), make<C>(5), test_allocator<int>(3));
+ Test<int> q(std::less<int>(), make<C>(5), test_allocator<int>(3));
assert(q.c.get_allocator() == test_allocator<int>(3));
assert(q.size() == 5);
assert(q.top() == 4);
+ return true;
+}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_copy_alloc.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_copy_alloc.pass.cpp
index e658d6ce874f2..c7784221ec210 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_copy_alloc.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_copy_alloc.pass.cpp
@@ -14,8 +14,10 @@
#include <queue>
#include <cassert>
+#include "test_macros.h"
+
template <class C>
-C make(int n) {
+TEST_CONSTEXPR_CXX26 C make(int n) {
C c;
for (int i = 0; i < n; ++i)
c.push_back(i);
@@ -26,27 +28,36 @@ C make(int n) {
#include "test_allocator.h"
template <class T>
-struct test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
+struct Test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
typedef typename base::container_type container_type;
typedef typename base::value_compare value_compare;
- explicit test(const test_allocator<int>& a) : base(a) {}
- test(const value_compare& compare, const test_allocator<int>& a) : base(compare, c, a) {}
- test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
+ TEST_CONSTEXPR_CXX26 explicit Test(const test_allocator<int>& a) : base(a) {}
+ TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, const test_allocator<int>& a) : base(compare, c, a) {}
+ TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
: base(compare, container, a) {}
- test(const test& q, const test_allocator<int>& a) : base(q, a) {}
- test_allocator<int> get_allocator() { return c.get_allocator(); }
+ TEST_CONSTEXPR_CXX26 Test(const Test& q, const test_allocator<int>& a) : base(q, a) {}
+ TEST_CONSTEXPR_CXX26 test_allocator<int> get_allocator() { return c.get_allocator(); }
using base::c;
};
-int main(int, char**) {
- test<int> qo(std::less<int>(), make<std::vector<int, test_allocator<int> > >(5), test_allocator<int>(2));
- test<int> q(qo, test_allocator<int>(6));
+TEST_CONSTEXPR_CXX26 bool test() {
+ Test<int> qo(std::less<int>(), make<std::vector<int, test_allocator<int> > >(5), test_allocator<int>(2));
+ Test<int> q(qo, test_allocator<int>(6));
assert(q.size() == 5);
assert(q.c.get_allocator() == test_allocator<int>(6));
assert(q.top() == int(4));
+ return true;
+}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_alloc.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_alloc.pass.cpp
index 4786629d46a41..ee1af396314b4 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_alloc.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_alloc.pass.cpp
@@ -23,12 +23,12 @@ struct PQ : std::priority_queue<T, Cont, Comp> {
typedef std::priority_queue<T, Cont, Comp> base;
template <class It, class Alloc>
- explicit PQ(It first, It last, const Alloc& a) : base(first, last, a) {}
+ TEST_CONSTEXPR_CXX26 explicit PQ(It first, It last, const Alloc& a) : base(first, last, a) {}
using base::c;
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
int a[] = {3, 5, 2, 0, 6, 8, 1};
typedef test_allocator<int> Alloc;
PQ<int, std::vector<int, Alloc> > q(a, a + 7, Alloc(2));
@@ -36,5 +36,14 @@ int main(int, char**) {
assert(q.top() == 8);
assert(q.c.get_allocator() == Alloc(2));
+ return true;
+}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_comp_alloc.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_comp_alloc.pass.cpp
index d3e11b30b1f16..31a72ad0185c9 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_comp_alloc.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_comp_alloc.pass.cpp
@@ -24,12 +24,13 @@ struct PQ : std::priority_queue<T, Cont, Comp> {
typedef std::priority_queue<T, Cont, Comp> base;
template <class It, class Alloc>
- explicit PQ(It first, It last, const Comp& compare, const Alloc& a) : base(first, last, compare, a) {}
+ TEST_CONSTEXPR_CXX26 explicit PQ(It first, It last, const Comp& compare, const Alloc& a)
+ : base(first, last, compare, a) {}
using base::c;
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
int a[] = {3, 5, 2, 0, 6, 8, 1};
typedef test_allocator<int> Alloc;
PQ<int, std::vector<int, Alloc>, std::greater<int> > q(a, a + 7, std::greater<int>(), Alloc(2));
@@ -37,5 +38,14 @@ int main(int, char**) {
assert(q.top() == 0);
assert(q.c.get_allocator() == Alloc(2));
+ return true;
+}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_comp_cont_alloc.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_comp_cont_alloc.pass.cpp
index a989ca1559630..25b1e0ecb9fce 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_comp_cont_alloc.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_comp_cont_alloc.pass.cpp
@@ -23,13 +23,13 @@ struct PQ : std::priority_queue<T, Cont, Comp> {
typedef std::priority_queue<T, Cont, Comp> base;
template <class It, class Alloc>
- explicit PQ(It first, It last, const Comp& compare, const Cont& v, const Alloc& a)
+ TEST_CONSTEXPR_CXX26 explicit PQ(It first, It last, const Comp& compare, const Cont& v, const Alloc& a)
: base(first, last, compare, v, a) {}
using base::c;
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
typedef test_allocator<int> Alloc;
int a[] = {3, 5, 2, 0, 6, 8, 1};
std::vector<int, Alloc> v(a, a + 3);
@@ -38,5 +38,14 @@ int main(int, char**) {
assert(q.top() == 8);
assert(q.c.get_allocator() == Alloc(2));
+ return true;
+}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_comp_rcont_alloc.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_comp_rcont_alloc.pass.cpp
index bd373629955ed..ab1b1e129d8c5 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_comp_rcont_alloc.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_iter_iter_comp_rcont_alloc.pass.cpp
@@ -26,13 +26,13 @@ struct PQ : std::priority_queue<T, Cont, Comp> {
typedef std::priority_queue<T, Cont, Comp> base;
template <class It, class Alloc>
- explicit PQ(It first, It last, const Comp& compare, Cont&& v, const Alloc& a)
+ TEST_CONSTEXPR_CXX26 explicit PQ(It first, It last, const Comp& compare, Cont&& v, const Alloc& a)
: base(first, last, compare, std::move(v), a) {}
using base::c;
};
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
using Alloc = test_allocator<MoveOnly>;
int a[] = {3, 5, 2, 0, 6, 8, 1};
PQ<MoveOnly, std::vector<MoveOnly, Alloc>> q(
@@ -41,5 +41,14 @@ int main(int, char**) {
assert(q.top() == MoveOnly(8));
assert(q.c.get_allocator() == Alloc(2));
+ return true;
+}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp
index 95c88cf877a59..8bb3b1754fc4a 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons.alloc/ctor_move_alloc.pass.cpp
@@ -20,7 +20,7 @@
#include "MoveOnly.h"
template <class C>
-C make(int n) {
+TEST_CONSTEXPR_CXX26 C make(int n) {
C c;
for (int i = 0; i < n; ++i)
c.push_back(MoveOnly(i));
@@ -30,30 +30,39 @@ C make(int n) {
#include "test_allocator.h"
template <class T>
-struct test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
+struct Test : public std::priority_queue<T, std::vector<T, test_allocator<T> > > {
typedef std::priority_queue<T, std::vector<T, test_allocator<T> > > base;
typedef typename base::container_type container_type;
typedef typename base::value_compare value_compare;
- explicit test(const test_allocator<int>& a) : base(a) {}
- test(const value_compare& compare, const test_allocator<int>& a) : base(compare, c, a) {}
- test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
+ TEST_CONSTEXPR_CXX26 explicit Test(const test_allocator<int>& a) : base(a) {}
+ TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, const test_allocator<int>& a) : base(compare, c, a) {}
+ TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, const container_type& container, const test_allocator<int>& a)
: base(compare, container, a) {}
- test(const value_compare& compare, container_type&& container, const test_allocator<int>& a)
+ TEST_CONSTEXPR_CXX26 Test(const value_compare& compare, container_type&& container, const test_allocator<int>& a)
: base(compare, std::move(container), a) {}
- test(test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
- test_allocator<int> get_allocator() { return c.get_allocator(); }
+ TEST_CONSTEXPR_CXX26 Test(Test&& q, const test_allocator<int>& a) : base(std::move(q), a) {}
+ TEST_CONSTEXPR_CXX26 test_allocator<int> get_allocator() { return c.get_allocator(); }
using base::c;
};
-int main(int, char**) {
- test<MoveOnly> qo(
+TEST_CONSTEXPR_CXX26 bool test() {
+ Test<MoveOnly> qo(
std::less<MoveOnly>(), make<std::vector<MoveOnly, test_allocator<MoveOnly> > >(5), test_allocator<MoveOnly>(2));
- test<MoveOnly> q(std::move(qo), test_allocator<MoveOnly>(6));
+ Test<MoveOnly> q(std::move(qo), test_allocator<MoveOnly>(6));
assert(q.size() == 5);
assert(q.c.get_allocator() == test_allocator<MoveOnly>(6));
assert(q.top() == MoveOnly(4));
+ return true;
+}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_copy.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_copy.pass.cpp
index 6acc8aef34569..100591d96a664 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_copy.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_copy.pass.cpp
@@ -17,14 +17,14 @@
#include "test_macros.h"
template <class C>
-C make(int n) {
+TEST_CONSTEXPR_CXX26 C make(int n) {
C c;
for (int i = 0; i < n; ++i)
c.push_back(i);
return c;
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
std::vector<int> v = make<std::vector<int> >(5);
std::priority_queue<int, std::vector<int>, std::greater<int> > qo(std::greater<int>(), v);
std::priority_queue<int, std::vector<int>, std::greater<int> > q;
@@ -32,5 +32,14 @@ int main(int, char**) {
assert(q.size() == 5);
assert(q.top() == 0);
+ return true;
+}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp
index fbdc07f530662..5c9e554e3f937 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/assign_move.pass.cpp
@@ -19,19 +19,28 @@
#include "MoveOnly.h"
template <class C>
-C make(int n) {
+TEST_CONSTEXPR_CXX26 C make(int n) {
C c;
for (int i = 0; i < n; ++i)
c.push_back(MoveOnly(i));
return c;
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
std::priority_queue<MoveOnly> qo(std::less<MoveOnly>(), make<std::vector<MoveOnly> >(5));
std::priority_queue<MoveOnly> q;
q = std::move(qo);
assert(q.size() == 5);
assert(q.top() == MoveOnly(4));
+ return true;
+}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp
index 8e56ea6234e61..a3491efab3eac 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp.pass.cpp
@@ -19,7 +19,7 @@
# include "test_convertible.h"
#endif
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
typedef std::vector<int, limited_allocator<int, 10> > Container;
typedef std::less<int> Compare;
typedef std::priority_queue<int, Container> Q;
@@ -34,5 +34,14 @@ int main(int, char**) {
static_assert(!test_convertible<Q, const Compare&>(), "");
#endif
+ return true;
+}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_container.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_container.pass.cpp
index 08e74a790f905..a08153efbeb7f 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_container.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_container.pass.cpp
@@ -20,14 +20,14 @@
#endif
template <class C>
-C make(int n) {
+TEST_CONSTEXPR_CXX26 C make(int n) {
C c;
for (int i = 0; i < n; ++i)
c.push_back(i);
return c;
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
typedef std::vector<int> Container;
typedef std::greater<int> Compare;
typedef std::priority_queue<int, Container, Compare> Q;
@@ -41,5 +41,14 @@ int main(int, char**) {
static_assert(test_convertible<Q, const Compare&, const Container&>(), "");
#endif
+ return true;
+}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp
index f0b0eaef2f3d5..6b5c0205ce8a5 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp
@@ -21,22 +21,30 @@
#include "test_convertible.h"
template <class C>
-C make(int n) {
+TEST_CONSTEXPR_CXX26 C make(int n) {
C c;
for (int i = 0; i < n; ++i)
c.push_back(MoveOnly(i));
return c;
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
typedef std::vector<MoveOnly> Container;
typedef std::less<MoveOnly> Compare;
typedef std::priority_queue<MoveOnly> Q;
Q q(Compare(), make<Container>(5));
assert(q.size() == 5);
assert(q.top() == MoveOnly(4));
-
static_assert(test_convertible<Q, const Compare&, Container&&>(), "");
+ return true;
+}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_copy.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_copy.pass.cpp
index 0e9f58ec8b9c9..591487b47c732 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_copy.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_copy.pass.cpp
@@ -17,19 +17,28 @@
#include "test_macros.h"
template <class C>
-C make(int n) {
+TEST_CONSTEXPR_CXX26 C make(int n) {
C c;
for (int i = 0; i < n; ++i)
c.push_back(i);
return c;
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
std::vector<int> v = make<std::vector<int> >(5);
std::priority_queue<int, std::vector<int>, std::greater<int> > qo(std::greater<int>(), v);
std::priority_queue<int, std::vector<int>, std::greater<int> > q = qo;
assert(q.size() == 5);
assert(q.top() == 0);
+ return true;
+}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_default.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_default.pass.cpp
index c25caee07ff49..5aa2c00691a27 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_default.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_default.pass.cpp
@@ -21,7 +21,7 @@
# include "test_convertible.h"
#endif
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
typedef std::vector<int, limited_allocator<int, 10> > Container;
typedef std::priority_queue<int, Container> Q;
Q q;
@@ -36,5 +36,14 @@ int main(int, char**) {
static_assert(test_convertible<Q>(), "");
#endif
+ return true;
+}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter.pass.cpp
index 9566c18193fbb..a9de31993ce62 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter.pass.cpp
@@ -17,12 +17,21 @@
#include "test_macros.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
int a[] = {3, 5, 2, 0, 6, 8, 1};
int* an = a + sizeof(a) / sizeof(a[0]);
std::priority_queue<int> q(a, an);
assert(q.size() == static_cast<std::size_t>(an - a));
assert(q.top() == 8);
+ return true;
+}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp.pass.cpp
index aa3e31b919572..a65ca970d2e7e 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp.pass.cpp
@@ -18,12 +18,21 @@
#include "test_macros.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
int a[] = {3, 5, 2, 0, 6, 8, 1};
int* an = a + sizeof(a) / sizeof(a[0]);
std::priority_queue<int, std::vector<int>, std::greater<int> > q(a, an, std::greater<int>());
assert(q.size() == static_cast<std::size_t>(an - a));
assert(q.top() == 0);
+ return true;
+}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_cont.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_cont.pass.cpp
index 49518488f6c99..a2818f13e03b9 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_cont.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_cont.pass.cpp
@@ -17,7 +17,7 @@
#include "test_macros.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
int a[] = {3, 5, 2, 0, 6, 8, 1};
const int n = sizeof(a) / sizeof(a[0]);
std::vector<int> v(a, a + n / 2);
@@ -25,5 +25,14 @@ int main(int, char**) {
assert(q.size() == n);
assert(q.top() == 8);
+ return true;
+}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp
index 85e31054babc8..72cf9e51bc681 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_iter_iter_comp_rcont.pass.cpp
@@ -20,12 +20,21 @@
#include "test_macros.h"
#include "MoveOnly.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
int a[] = {3, 5, 2, 0, 6, 8, 1};
const int n = sizeof(a) / sizeof(a[0]);
std::priority_queue<MoveOnly> q(a + n / 2, a + n, std::less<MoveOnly>(), std::vector<MoveOnly>(a, a + n / 2));
assert(q.size() == n);
assert(q.top() == MoveOnly(8));
+ return true;
+}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp
index 74213881e98f3..b45d30ecb5029 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.cons/ctor_move.pass.cpp
@@ -19,18 +19,27 @@
#include "MoveOnly.h"
template <class C>
-C make(int n) {
+TEST_CONSTEXPR_CXX26 C make(int n) {
C c;
for (int i = 0; i < n; ++i)
c.push_back(MoveOnly(i));
return c;
}
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
std::priority_queue<MoveOnly> qo(std::less<MoveOnly>(), make<std::vector<MoveOnly> >(5));
std::priority_queue<MoveOnly> q = std::move(qo);
assert(q.size() == 5);
assert(q.top() == MoveOnly(4));
- return 0;
+ return true;
}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
+ return 0;
+}
\ No newline at end of file
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp
index f9f88fd843082..9c1fdb1cf9515 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp
@@ -20,7 +20,7 @@
#include "test_macros.h"
#include "../../../Emplaceable.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
std::priority_queue<Emplaceable> q;
q.emplace(1, 2.5);
assert(q.top() == Emplaceable(1, 2.5));
@@ -29,5 +29,14 @@ int main(int, char**) {
q.emplace(2, 3.5);
assert(q.top() == Emplaceable(3, 4.5));
+ return true;
+}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/empty.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/empty.pass.cpp
index 758c5354aea4d..265b559e04bbf 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/empty.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/empty.pass.cpp
@@ -17,7 +17,7 @@
#include "test_macros.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
std::priority_queue<int> q;
assert(q.empty());
q.push(1);
@@ -25,5 +25,14 @@ int main(int, char**) {
q.pop();
assert(q.empty());
+ return true;
+}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/pop.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/pop.pass.cpp
index dba6614ad5b69..d715cf378a3d0 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/pop.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/pop.pass.cpp
@@ -17,7 +17,7 @@
#include "test_macros.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
std::priority_queue<int> q;
q.push(1);
assert(q.top() == 1);
@@ -32,5 +32,14 @@ int main(int, char**) {
q.pop();
assert(q.empty());
+ return true;
+}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/push.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/push.pass.cpp
index 36ba7d241c5ba..a242942caef6f 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/push.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/push.pass.cpp
@@ -17,7 +17,7 @@
#include "test_macros.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
std::priority_queue<int> q;
q.push(1);
assert(q.top() == 1);
@@ -26,5 +26,14 @@ int main(int, char**) {
q.push(2);
assert(q.top() == 3);
+ return true;
+}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp
index 7700b641a429b..ce0399b647067 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/push_rvalue.pass.cpp
@@ -20,7 +20,7 @@
#include "test_macros.h"
#include "MoveOnly.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
std::priority_queue<MoveOnly> q;
q.push(1);
assert(q.top() == 1);
@@ -29,5 +29,14 @@ int main(int, char**) {
q.push(2);
assert(q.top() == 3);
+ return true;
+}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/size.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/size.pass.cpp
index 2c6b00b87c6ba..a8e0002b98087 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/size.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/size.pass.cpp
@@ -17,7 +17,7 @@
#include "test_macros.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
std::priority_queue<int> q;
assert(q.size() == 0);
q.push(1);
@@ -25,5 +25,14 @@ int main(int, char**) {
q.pop();
assert(q.size() == 0);
+ return true;
+}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/swap.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/swap.pass.cpp
index 87e6722d79e35..8c6ad7f905c01 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/swap.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/swap.pass.cpp
@@ -17,7 +17,7 @@
#include "test_macros.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
std::priority_queue<int> q1;
std::priority_queue<int> q2;
q1.push(1);
@@ -28,5 +28,14 @@ int main(int, char**) {
assert(q2.size() == 3);
assert(q2.top() == 3);
+ return true;
+}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/top.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/top.pass.cpp
index 8b046bc3ccca5..623c54561e29d 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/top.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.members/top.pass.cpp
@@ -17,7 +17,7 @@
#include "test_macros.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
std::priority_queue<int> q;
q.push(1);
assert(q.top() == 1);
@@ -26,5 +26,14 @@ int main(int, char**) {
q.push(2);
assert(q.top() == 3);
+ return true;
+}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
return 0;
}
diff --git a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap.pass.cpp b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap.pass.cpp
index c280601baf17d..8e73517423059 100644
--- a/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap.pass.cpp
+++ b/libcxx/test/std/containers/container.adaptors/priority.queue/priqueue.special/swap.pass.cpp
@@ -19,7 +19,7 @@
#include "test_macros.h"
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
std::priority_queue<int> q1;
std::priority_queue<int> q2;
q1.push(1);
@@ -30,5 +30,14 @@ int main(int, char**) {
assert(q2.size() == 3);
assert(q2.top() == 3);
+ return true;
+}
+
+int main(int, char**) {
+ assert(test());
+#if TEST_STD_VER >= 26
+ static_assert(test());
+#endif
+
return 0;
}
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/queue.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/queue.version.compile.pass.cpp
index 6aff89ae3f95a..0ebfc6de84104 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/queue.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/queue.version.compile.pass.cpp
@@ -24,6 +24,10 @@
# error "__cpp_lib_adaptor_iterator_pair_constructor should not be defined before c++23"
# endif
+# ifdef __cpp_lib_constexpr_queue
+# error "__cpp_lib_constexpr_queue should not be defined before c++26"
+# endif
+
# ifdef __cpp_lib_containers_ranges
# error "__cpp_lib_containers_ranges should not be defined before c++23"
# endif
@@ -34,6 +38,10 @@
# error "__cpp_lib_adaptor_iterator_pair_constructor should not be defined before c++23"
# endif
+# ifdef __cpp_lib_constexpr_queue
+# error "__cpp_lib_constexpr_queue should not be defined before c++26"
+# endif
+
# ifdef __cpp_lib_containers_ranges
# error "__cpp_lib_containers_ranges should not be defined before c++23"
# endif
@@ -44,6 +52,10 @@
# error "__cpp_lib_adaptor_iterator_pair_constructor should not be defined before c++23"
# endif
+# ifdef __cpp_lib_constexpr_queue
+# error "__cpp_lib_constexpr_queue should not be defined before c++26"
+# endif
+
# ifdef __cpp_lib_containers_ranges
# error "__cpp_lib_containers_ranges should not be defined before c++23"
# endif
@@ -54,6 +66,10 @@
# error "__cpp_lib_adaptor_iterator_pair_constructor should not be defined before c++23"
# endif
+# ifdef __cpp_lib_constexpr_queue
+# error "__cpp_lib_constexpr_queue should not be defined before c++26"
+# endif
+
# ifdef __cpp_lib_containers_ranges
# error "__cpp_lib_containers_ranges should not be defined before c++23"
# endif
@@ -67,6 +83,10 @@
# error "__cpp_lib_adaptor_iterator_pair_constructor should have the value 202106L in c++23"
# endif
+# ifdef __cpp_lib_constexpr_queue
+# error "__cpp_lib_constexpr_queue should not be defined before c++26"
+# endif
+
# ifndef __cpp_lib_containers_ranges
# error "__cpp_lib_containers_ranges should be defined in c++23"
# endif
@@ -83,6 +103,13 @@
# error "__cpp_lib_adaptor_iterator_pair_constructor should have the value 202106L in c++26"
# endif
+# ifndef __cpp_lib_constexpr_queue
+# error "__cpp_lib_constexpr_queue should be defined in c++26"
+# endif
+# if __cpp_lib_constexpr_queue != 202502L
+# error "__cpp_lib_constexpr_queue should have the value 202502L in c++26"
+# endif
+
# ifndef __cpp_lib_containers_ranges
# error "__cpp_lib_containers_ranges should be defined in c++26"
# endif
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
index aa33a2788f1eb..b1cc4afd30696 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
@@ -216,6 +216,10 @@
# error "__cpp_lib_constexpr_numeric should not be defined before c++20"
# endif
+# ifdef __cpp_lib_constexpr_queue
+# error "__cpp_lib_constexpr_queue should not be defined before c++26"
+# endif
+
# ifdef __cpp_lib_constexpr_string
# error "__cpp_lib_constexpr_string should not be defined before c++20"
# endif
@@ -1100,6 +1104,10 @@
# error "__cpp_lib_constexpr_numeric should not be defined before c++20"
# endif
+# ifdef __cpp_lib_constexpr_queue
+# error "__cpp_lib_constexpr_queue should not be defined before c++26"
+# endif
+
# ifdef __cpp_lib_constexpr_string
# error "__cpp_lib_constexpr_string should not be defined before c++20"
# endif
@@ -2086,6 +2094,10 @@
# error "__cpp_lib_constexpr_numeric should not be defined before c++20"
# endif
+# ifdef __cpp_lib_constexpr_queue
+# error "__cpp_lib_constexpr_queue should not be defined before c++26"
+# endif
+
# ifdef __cpp_lib_constexpr_string
# error "__cpp_lib_constexpr_string should not be defined before c++20"
# endif
@@ -3324,6 +3336,10 @@
# error "__cpp_lib_constexpr_numeric should have the value 201911L in c++20"
# endif
+# ifdef __cpp_lib_constexpr_queue
+# error "__cpp_lib_constexpr_queue should not be defined before c++26"
+# endif
+
# ifndef __cpp_lib_constexpr_string
# error "__cpp_lib_constexpr_string should be defined in c++20"
# endif
@@ -4772,6 +4788,10 @@
# error "__cpp_lib_constexpr_numeric should have the value 201911L in c++23"
# endif
+# ifdef __cpp_lib_constexpr_queue
+# error "__cpp_lib_constexpr_queue should not be defined before c++26"
+# endif
+
# ifndef __cpp_lib_constexpr_string
# error "__cpp_lib_constexpr_string should be defined in c++23"
# endif
@@ -6448,6 +6468,13 @@
# error "__cpp_lib_constexpr_numeric should have the value 201911L in c++26"
# endif
+# ifndef __cpp_lib_constexpr_queue
+# error "__cpp_lib_constexpr_queue should be defined in c++26"
+# endif
+# if __cpp_lib_constexpr_queue != 202502L
+# error "__cpp_lib_constexpr_queue should have the value 202502L in c++26"
+# endif
+
# ifndef __cpp_lib_constexpr_string
# error "__cpp_lib_constexpr_string should be defined in c++26"
# endif
diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py
index 2b7f6fa8a48a9..82f0d09db5c36 100755
--- a/libcxx/utils/generate_feature_test_macro_components.py
+++ b/libcxx/utils/generate_feature_test_macro_components.py
@@ -384,6 +384,11 @@ def add_version_header(tc):
"values": {"c++20": 201911},
"headers": ["numeric"],
},
+ {
+ "name": "__cpp_lib_constexpr_queue",
+ "values": {"c++26": 202502},
+ "headers": ["queue"],
+ },
{
"name": "__cpp_lib_constexpr_string",
"values": {"c++20": 201907},
More information about the libcxx-commits
mailing list