Skip to content

Commit d1c4bbb

Browse files
From PR 134330
Apply initial _LIBCPP_CONSTEXPR_SINCE_CXX26 Add feature test macro one test to start with start seeing constexpr failures for at.pass.cpp member call on object outside its lifetime is not allowed in a constant expression Move past member call on object past it's lifetime Add ctor to initialize __value_type and __tree_node_base, and the object of unique_ptr construction works, at() fails due to throw_out_of_range can't intentionally throw in constexpr note: cast from 'void *' is not allowed in a constant expression because the pointed object type 'std::__tree_node<std::__value_type<int, double>, min_pointer<void>>' is not similar to the target type 'std::__tree_node_base<min_pointer<void>>' note: cast from 'void *' is not allowed in a constant expression because the pointed object type 'std::__tree_node<std::__value_type<int, double>, min_pointer<void>>' is not similar to the target type 'std::__tree_node_base<min_pointer<void>> ignore min_allocator tests for now at.pass.cpp works in cpp26 for some reason empty.verify.cpp passes index_key_.pass.cpp constexpr fixed, but other failure index_rv_key.pass.cpp constexpr fixed, but other failure fix index_tuple.pass.cpp fix: iterator.pass.cpp fix max_size.pass.cpp size.pass.cpp alloc.pass.cpp blocked on assign_initializer_list compare.pass.cpp Modify all tests to have TEST_CONSTEXPR_CXX26 and without passing at: copy_assign.addressof.compile.pass.cpp failing at copy_assign.pass.cpp only in constexpr pass deduct.pass.cpp fix map.cons/from_range.pass.cpp fail at map.cons/move_alloc.pass.cpp fail at map.cons/move_assign.pass.cpp fix map.cons/move_noexcept.pass.cpp pass map.erasure/erase_if.pass.cpp error: call to deleted constructor at map.modifiers/emplace.pass.cpp pass map.modifiers/erase_iter.pass.cpp pass map.modifiers/extract_iterator.pass.cpp TODO: node-handle tests pass map.modifiers/extract_key.pass.cpp pass map.modifiers/insert_and_emplace_allocator_requirements.pass.cpp pass map.modifiers/insert_cv.pass.cpp pass map.modifiers/insert_iter_cv.pass.cpp pass map.modifiers/insert_iter_rv.pass.cpp pass map.modifiers/insert_node_type.pass pass map.modifiers/insert_node_type_hint.pass.cpp pass map.modifiers/insert_or_assign.pass.cpp pass map.modifiers/insert_rv.pass.cpp pass map.modifiers/try.emplace.pass.cpp, fix typos pass map.nonmember/compare.three_way.pass.cpp pass map.nonmember/op_compare.pass.cpp pass map.observers/key_comp.pass.cpp pass map.observers/value_comp.pass.cpp pass map.ops/contains.pass.cpp pass map.ops/contains_transparent.pass.cpp pass map.ops/count.pass.cpp pass map.ops/count_transparent.pass.cpp pass map.ops/equal_range_transparent.pass.cpp pass map.special/member_swap.pass.cpp pass map.value_compare/invoke.pass.cpp pass map.value_compare/types.pass.cpp cleanup Pass compare.pass.cpp pass incomplete_type.pass.cpp error: call to deleted constructor of '__node_value_type' (aka 'std::__value_type<int, int>') clang-format Generate macro version correctly fix unrelated CI failures pass map.modifiers/emplace.pass.cpp pass map.modifiers/emplace_hint.pass.cpp at.pass.cpp passes again iterator.pass.cpp passes move_assign.pass.cpp constexpr fixed move_alloc.pass.cpp constexpr fixed, other remains copy_assign.pass.cpp constexpr fixed, other remains erase_iter.pass.cpp fix typo map.ops pass Partially fix assign_initializer_list.pass.cpp Fix assign_initializer_list.pass.cpp fix placement new to use std::addressof fix copy_assign.pass.cpp move alloc failure location git-clang-format upstream/main featuer test generation <__type_traits/is_constant_evaluated.h> __node_value_type Use __libcpp_is_constant_evaluated, still at 7 failures fix feature gen? feature macros ? lang support cf restore pair to main back at 7 failures due to min_allocator.h cf? insert_range.pass.cpp, empty passes, stuck at next min_allocator to main tree clang format fix CI? try CI fix? readability-identifier-naming libcpp-hide-from-abi cf _Args not Args map? generic-cxx03 libcpp-hide-from-abi cxx03 tmp WIP??? constexpr test ID* at.pass.cpp works empty.pass.cpp index_key.pass.cpp -> static_assert error: static assertion failed due to requirement 'std::is_same<std::__tree_node<std::__value_type<CopyInsertable<1>, CopyInsertable<2>>, void *>, std::pair<const CopyInsertable<1>, CopyInsertable<2>>>::value': Only allowed to construct Up iterator.pass.cpp size.pass.cpp map.cons/assign_initializer_list.pass.cpp map.modifiers/emplace.pass.cpp map.modifiers/emplace_hint.pass.cpp map.modifiers/erase_key.pass.cpp map.ops/count.pass.cpp map.ops/equal_range.pass.cpp map.ops/find.pass.cpp map.ops/upper_bound.pass.cpp clang-format fix error value_comp bad merge _root cannot be redeclared remove base and cast copy_assign.pass.cpp fails largely because of constexpr limit, because for Container<int, MoveOnly> c, issues happen similar to move_alloc move_assign use __node_traits::construct over placement new, copy_assing copy_alloc still pass cf note for failure TODO add constexpr cpp26 mistake 6 failures something clean clean more fix same_as allocate issues in index_rv_key failures at move_alloc and move_assign allocator for copy_assign index_rv_key at it again haxxx Temporary solution for UB & restriction copy_assign.pass.cpp Finally only 2 tests fail insert_key.pass.cpp Move_alloc.pass.cpp fails add docs move_alloc and move_assign, fail in __insert_unique_from_orphaned_node, need to place the SFINAE there, not in __assign_value kind of fixed it, almost Fix for move_assign almost a fix for move_assign.pass.cpp insert_range_maps_sets.h, needs a lot of constexpr depth add why sfinae insert_and_emplace_allocator_requirements.pass.cpp passes use the typedef remove concepts, collapse unnecessary sfinae some docs breaks correctly still correct failures with cleanup more cleans more clean PR review comment include __memory/construct_at `Assertion `getConstructController()->isInAllocatorConstruct()' failed.`Revert "PR review comment" This reverts commit 4fbb472. Fails with: ``` # .---command stderr------------ # | t.tmp.exe: /home/runner/_work/llvm-project/llvm-project/libcxx/test/support/container_test_types.h:399: CopyInsertable<1>::CopyInsertable(const CopyInsertable<Dummy> &) [Dummy = 1]: Assertion `getConstructController()->isInAllocatorConstruct()' failed. # `----------------------------- # error: command failed with exit status: 250 ``` one clean cleanup for libcxx/test/support/container_test_types.h clean back clang-format adjust constexpr steps arg clean Redundant check Add ReleaseNotes use allocator as template arg and allocator_traits, tests passed in cpp26 cf hide from abi Attempt fix for gcc-15 std=c++26 try format and arm fix attempt' cf fix non-ascii =default; noop abi constexpr-dtor WIP: gcc-15 failure investigation fix the first failure with ptr_ is uninitialized fix map revert min_allocator default construction _ptr is not initialized use allocator as template arg and allocator_traits, tests passed in cpp26 remove UB using list cf doc-fix Replace __value_ with __get_value() for __tree_node miss typo fix ctor for cpp03 buffer cf rename in map as well cf include more? hide from abi terser redundant launder single branch remove the & from buffer remove _LIBCPP_STANDALONE_DEBUG cf disable test for g++-15 remove debugging attempts Remove debugging attempt Fix testing at runtime as well Description and links partial fix for } restore TEST_HAS_NO_EXCEPTIONS Remove extra include remove set -x undo debug attempts Refactor libcxx/test/std/containers/associative/map/map.modifiers/insert_range.pass.cpp CWG1514: key() is not constexpr static can't be constexpr Refactor libcxx/test/std/containers/associative/map/map.cons/from_range.pass.cpp Refactor libcxx/test/std/containers/associative/map/map.cons/copy_alloc.pass.cpp Refactor libcxx/test/std/containers/associative/map/map.cons/copy.pass.cpp Refactor libcxx/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp Refactor libcxx/test/std/containers/associative/map/map.access/index_key.pass.cpp grammar Pass the generic-hardening-mode-debug cf and remove non-ascii Remove hide abi obsolete comment Add FIXME Apply cf cf add constexpr cf Move ReleaseNotes to Implemented papers Fix order of annotations node-handle doc unrelated defaulting undo previous unnecessary destructor for __tree_node_base Remove constexpr from cpp03 code Unnecessary annotation on deleted function simplify type_trait Allow runtime decision for __insert_unique_from_orphaned_node Allow runtime decision for __assign_value local cf Simplify at.pass.cpp use TEST_IS_CONSTANT_EVALUATED over libcxx function Remove extra arm CI hack missing space Avoid creating a __tmp explicit copy Remove constexpr annotations from multimap CI fix for clang <=20 Check clang<20 only for clang based compilers Fix apple-clang macro lookup Fixme, not todo Updated FIXME Remove assert(test()); clang-format? Synopsis attach: // constexpr since C++26 Revert "Remove assert(test());" This reverts commit 9f931f5. Fix the sed script
1 parent fe02993 commit d1c4bbb

File tree

93 files changed

+2504
-1824
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+2504
-1824
lines changed

libcxx/docs/FeatureTestMacroTable.rst

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,6 @@ Status
198198
---------------------------------------------------------- -----------------
199199
``__cpp_lib_char8_t`` ``201907L``
200200
---------------------------------------------------------- -----------------
201-
``__cpp_lib_common_reference`` ``202302L``
202-
---------------------------------------------------------- -----------------
203-
``__cpp_lib_common_reference_wrapper`` ``202302L``
204-
---------------------------------------------------------- -----------------
205201
``__cpp_lib_concepts`` ``202002L``
206202
---------------------------------------------------------- -----------------
207203
``__cpp_lib_constexpr_algorithms`` ``201806L``
@@ -380,7 +376,7 @@ Status
380376
---------------------------------------------------------- -----------------
381377
``__cpp_lib_ranges_iota`` ``202202L``
382378
---------------------------------------------------------- -----------------
383-
``__cpp_lib_ranges_join_with`` ``202202L``
379+
``__cpp_lib_ranges_join_with`` *unimplemented*
384380
---------------------------------------------------------- -----------------
385381
``__cpp_lib_ranges_repeat`` ``202207L``
386382
---------------------------------------------------------- -----------------
@@ -418,8 +414,6 @@ Status
418414
---------------------------------------------------------- -----------------
419415
``__cpp_lib_atomic_min_max`` *unimplemented*
420416
---------------------------------------------------------- -----------------
421-
``__cpp_lib_atomic_ref`` ``202411L``
422-
---------------------------------------------------------- -----------------
423417
``__cpp_lib_bind_front`` ``202306L``
424418
---------------------------------------------------------- -----------------
425419
``__cpp_lib_bitset`` ``202306L``
@@ -430,11 +424,13 @@ Status
430424
---------------------------------------------------------- -----------------
431425
``__cpp_lib_constexpr_list`` ``202502L``
432426
---------------------------------------------------------- -----------------
427+
``__cpp_lib_constexpr_map`` ``202502L``
428+
---------------------------------------------------------- -----------------
433429
``__cpp_lib_constexpr_new`` ``202406L``
434430
---------------------------------------------------------- -----------------
435431
``__cpp_lib_constexpr_queue`` ``202502L``
436432
---------------------------------------------------------- -----------------
437-
``__cpp_lib_constrained_equality`` ``202411L``
433+
``__cpp_lib_constrained_equality`` *unimplemented*
438434
---------------------------------------------------------- -----------------
439435
``__cpp_lib_copyable_function`` *unimplemented*
440436
---------------------------------------------------------- -----------------
@@ -482,16 +478,14 @@ Status
482478
---------------------------------------------------------- -----------------
483479
``__cpp_lib_not_fn`` ``202306L``
484480
---------------------------------------------------------- -----------------
485-
``__cpp_lib_optional_range_support`` ``202406L``
481+
``__cpp_lib_optional_range_support`` *unimplemented*
486482
---------------------------------------------------------- -----------------
487483
``__cpp_lib_out_ptr`` ``202311L``
488484
---------------------------------------------------------- -----------------
489485
``__cpp_lib_philox_engine`` *unimplemented*
490486
---------------------------------------------------------- -----------------
491487
``__cpp_lib_ranges_concat`` *unimplemented*
492488
---------------------------------------------------------- -----------------
493-
``__cpp_lib_ranges_indices`` ``202506L``
494-
---------------------------------------------------------- -----------------
495489
``__cpp_lib_ratio`` ``202306L``
496490
---------------------------------------------------------- -----------------
497491
``__cpp_lib_rcu`` *unimplemented*
@@ -510,8 +504,6 @@ Status
510504
---------------------------------------------------------- -----------------
511505
``__cpp_lib_sstream_from_string_view`` ``202306L``
512506
---------------------------------------------------------- -----------------
513-
``__cpp_lib_string_subview`` ``202506L``
514-
---------------------------------------------------------- -----------------
515507
``__cpp_lib_string_view`` ``202403L``
516508
---------------------------------------------------------- -----------------
517509
``__cpp_lib_submdspan`` *unimplemented*

libcxx/docs/ReleaseNotes/22.rst

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,8 @@ Implemented Papers
4040

4141
- P2321R2: ``zip`` (`Github <https://llvm.org/PR105169>`__) (The paper is partially implemented. ``zip_transform_view``
4242
is implemented in this release)
43-
- P3044R2: sub-``string_view`` from ``string`` (`Github <https://llvm.org/PR148140>`__)
44-
- P3223R2: Making ``std::istream::ignore`` less surprising (`Github <https://llvm.org/PR148178>`__)
45-
- P3060R3: Add ``std::views::indices(n)`` (`Github <https://llvm.org/PR148175>`__)
46-
- P2835R7: Expose ``std::atomic_ref``'s object address (`Github <https://llvm.org/PR118377>`__)
4743
- P3168R2: Give ``std::optional`` Range Support (`Github <https://llvm.org/PR105430>`__)
44+
- P3372R3: ``constexpr map`` (`Github <https://llvm.org/PR134330>`__) (The paper is partially implemented. ``constexpr map`` is implemented in this release)
4845

4946
Improvements and New Features
5047
-----------------------------
@@ -67,14 +64,6 @@ Improvements and New Features
6764
- Multiple internal types have been refactored to use ``[[no_unique_address]]``, resulting in faster compile times and
6865
reduced debug information.
6966

70-
- The performance of ``std::find`` has been improved by up to 2x for integral types
71-
- The ``std::distance`` and ``std::ranges::distance`` algorithms have been optimized for segmented iterators (e.g.,
72-
``std::join_view`` iterators), reducing the complexity from ``O(n)`` to ``O(n / segment_size)``. Benchmarks show
73-
performance improvements of over 1600x in favorable cases with large segment sizes (e.g., 1024).
74-
- The ``std::{fill, fill_n}`` and ``std::ranges::{fill, fill_n}`` algorithms have been optimized for segmented iterators,
75-
resulting in a performance improvement of at least 10x for ``std::deque<int>`` iterators and
76-
``std::join_view<std::vector<std::vector<int>>>`` iterators.
77-
7867
Deprecations and Removals
7968
-------------------------
8069

libcxx/include/__iterator/erase_if_container.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ _LIBCPP_PUSH_MACROS
2222
_LIBCPP_BEGIN_NAMESPACE_STD
2323

2424
template <class _Container, class _Predicate>
25-
_LIBCPP_HIDE_FROM_ABI typename _Container::size_type __libcpp_erase_if_container(_Container& __c, _Predicate& __pred) {
25+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 typename _Container::size_type
26+
__libcpp_erase_if_container(_Container& __c, _Predicate& __pred) {
2627
typename _Container::size_type __old_size = __c.size();
2728

2829
const typename _Container::iterator __last = __c.end();

libcxx/include/__node_handle

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,30 +30,30 @@ private:
3030
3131
public:
3232
// [container.node.cons], constructors, copy, and assignment
33-
constexpr node-handle() noexcept : ptr_(), alloc_() {}
34-
node-handle(node-handle&&) noexcept;
35-
node-handle& operator=(node-handle&&);
33+
constexpr node-handle() noexcept : ptr_(), alloc_() {} // constexpr since C++26
34+
node-handle(node-handle&&) noexcept; // constexpr since C++26
35+
node-handle& operator=(node-handle&&); // constexpr since C++26
3636
3737
// [container.node.dtor], destructor
38-
~node-handle();
38+
~node-handle(); // constexpr since C++26
3939
4040
// [container.node.observers], observers
4141
value_type& value() const; // not present for map containers
4242
key_type& key() const; // not present for set containers
43-
mapped_type& mapped() const; // not present for set containers
43+
mapped_type& mapped() const; // not present for set containers // constexpr since C++26
4444
45-
allocator_type get_allocator() const;
46-
explicit operator bool() const noexcept;
47-
[[nodiscard]] bool empty() const noexcept; // nodiscard since C++20
45+
allocator_type get_allocator() const; // constexpr since C++26
46+
explicit operator bool() const noexcept; // constexpr since C++26
47+
[[nodiscard]] bool empty() const noexcept; // nodiscard since C++20 // constexpr since C++26
4848
4949
// [container.node.modifiers], modifiers
5050
void swap(node-handle&)
5151
noexcept(ator_traits::propagate_on_container_swap::value ||
52-
ator_traits::is_always_equal::value);
52+
ator_traits::is_always_equal::value); // constexpr since C++26
5353
5454
friend void swap(node-handle& x, node-handle& y) noexcept(noexcept(x.swap(y))) {
5555
x.swap(y);
56-
}
56+
} // constexpr since C++26
5757
};
5858
5959
*/
@@ -99,12 +99,12 @@ private:
9999
__node_pointer_type __ptr_ = nullptr;
100100
optional<allocator_type> __alloc_;
101101

102-
_LIBCPP_HIDE_FROM_ABI void __release_ptr() {
102+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __release_ptr() {
103103
__ptr_ = nullptr;
104104
__alloc_ = std::nullopt;
105105
}
106106

107-
_LIBCPP_HIDE_FROM_ABI void __destroy_node_pointer() {
107+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __destroy_node_pointer() {
108108
if (__ptr_ != nullptr) {
109109
typedef typename __allocator_traits_rebind< allocator_type, _NodeType>::type __node_alloc_type;
110110
__node_alloc_type __alloc(*__alloc_);
@@ -113,19 +113,20 @@ private:
113113
}
114114
}
115115

116-
_LIBCPP_HIDE_FROM_ABI __basic_node_handle(__node_pointer_type __ptr, allocator_type const& __alloc)
116+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26
117+
__basic_node_handle(__node_pointer_type __ptr, allocator_type const& __alloc)
117118
: __ptr_(__ptr), __alloc_(__alloc) {}
118119

119120
public:
120-
_LIBCPP_HIDE_FROM_ABI __basic_node_handle() = default;
121+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __basic_node_handle() = default;
121122

122-
_LIBCPP_HIDE_FROM_ABI __basic_node_handle(__basic_node_handle&& __other) noexcept
123+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __basic_node_handle(__basic_node_handle&& __other) noexcept
123124
: __ptr_(__other.__ptr_), __alloc_(std::move(__other.__alloc_)) {
124125
__other.__ptr_ = nullptr;
125126
__other.__alloc_ = std::nullopt;
126127
}
127128

128-
_LIBCPP_HIDE_FROM_ABI __basic_node_handle& operator=(__basic_node_handle&& __other) {
129+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __basic_node_handle& operator=(__basic_node_handle&& __other) {
129130
_LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
130131
__alloc_ == std::nullopt || __alloc_traits::propagate_on_container_move_assignment::value ||
131132
__alloc_ == __other.__alloc_,
@@ -144,13 +145,13 @@ public:
144145
return *this;
145146
}
146147

147-
_LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const { return *__alloc_; }
148+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 allocator_type get_allocator() const { return *__alloc_; }
148149

149-
_LIBCPP_HIDE_FROM_ABI explicit operator bool() const { return __ptr_ != nullptr; }
150+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit operator bool() const { return __ptr_ != nullptr; }
150151

151-
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool empty() const { return __ptr_ == nullptr; }
152+
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool empty() const { return __ptr_ == nullptr; }
152153

153-
_LIBCPP_HIDE_FROM_ABI void swap(__basic_node_handle& __other) noexcept(
154+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void swap(__basic_node_handle& __other) noexcept(
154155
__alloc_traits::propagate_on_container_swap::value || __alloc_traits::is_always_equal::value) {
155156
using std::swap;
156157
swap(__ptr_, __other.__ptr_);
@@ -159,12 +160,12 @@ public:
159160
swap(__alloc_, __other.__alloc_);
160161
}
161162

162-
_LIBCPP_HIDE_FROM_ABI friend void
163+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 friend void
163164
swap(__basic_node_handle& __a, __basic_node_handle& __b) noexcept(noexcept(__a.swap(__b))) {
164165
__a.swap(__b);
165166
}
166167

167-
_LIBCPP_HIDE_FROM_ABI ~__basic_node_handle() { __destroy_node_pointer(); }
168+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 ~__basic_node_handle() { __destroy_node_pointer(); }
168169
};
169170

170171
template <class _NodeType, class _Derived>
@@ -179,6 +180,7 @@ struct __map_node_handle_specifics {
179180
using key_type = __remove_const_t<typename _NodeType::__node_value_type::first_type>;
180181
using mapped_type = typename _NodeType::__node_value_type::second_type;
181182

183+
// This method is not constexpr as per the standard.
182184
_LIBCPP_HIDE_FROM_ABI key_type& key() const {
183185
return const_cast<key_type&>(static_cast<_Derived const*>(this)->__ptr_->__get_value().first);
184186
}

0 commit comments

Comments
 (0)