Skip to content

Commit 0574be6

Browse files
construction works, at() fails due to throw_out_of_range
1 parent cec33fb commit 0574be6

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

libcxx/include/__tree

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ __root, have a non-null __parent_ field.
9898
// Returns: true if __x is a left child of its parent, else false
9999
// Precondition: __x != nullptr.
100100
template <class _NodePtr>
101-
inline _LIBCPP_HIDE_FROM_ABI bool __tree_is_left_child(_NodePtr __x) _NOEXCEPT {
101+
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 bool __tree_is_left_child(_NodePtr __x) _NOEXCEPT {
102102
return __x == __x->__parent_->__left_;
103103
}
104104

@@ -164,7 +164,7 @@ inline _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_min(_NodePtr __x) _NOEXCEPT {
164164

165165
// Returns: pointer to the right-most node under __x.
166166
template <class _NodePtr>
167-
inline _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_max(_NodePtr __x) _NOEXCEPT {
167+
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _NodePtr __tree_max(_NodePtr __x) _NOEXCEPT {
168168
_LIBCPP_ASSERT_INTERNAL(__x != nullptr, "Root node shouldn't be null");
169169
while (__x->__right_ != nullptr)
170170
__x = __x->__right_;
@@ -195,7 +195,7 @@ inline _LIBCPP_HIDE_FROM_ABI _EndNodePtr __tree_next_iter(_NodePtr __x) _NOEXCEP
195195
// Returns: pointer to the previous in-order node before __x.
196196
// Note: __x may be the end node.
197197
template <class _NodePtr, class _EndNodePtr>
198-
inline _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_prev_iter(_EndNodePtr __x) _NOEXCEPT {
198+
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 _NodePtr __tree_prev_iter(_EndNodePtr __x) _NOEXCEPT {
199199
_LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
200200
if (__x->__left_ != nullptr)
201201
return std::__tree_max(__x->__left_);
@@ -226,7 +226,7 @@ _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_leaf(_NodePtr __x) _NOEXCEPT {
226226
// Effects: Makes __x->__right_ the subtree root with __x as its left child
227227
// while preserving in-order order.
228228
template <class _NodePtr>
229-
_LIBCPP_HIDE_FROM_ABI void __tree_left_rotate(_NodePtr __x) _NOEXCEPT {
229+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __tree_left_rotate(_NodePtr __x) _NOEXCEPT {
230230
_LIBCPP_ASSERT_INTERNAL(__x != nullptr, "node shouldn't be null");
231231
_LIBCPP_ASSERT_INTERNAL(__x->__right_ != nullptr, "node should have a right child");
232232
_NodePtr __y = __x->__right_;
@@ -269,7 +269,7 @@ _LIBCPP_HIDE_FROM_ABI void __tree_right_rotate(_NodePtr __x) _NOEXCEPT {
269269
// Postcondition: __tree_invariant(end_node->__left_) == true. end_node->__left_
270270
// may be different than the value passed in as __root.
271271
template <class _NodePtr>
272-
_LIBCPP_HIDE_FROM_ABI void __tree_balance_after_insert(_NodePtr __root, _NodePtr __x) _NOEXCEPT {
272+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __tree_balance_after_insert(_NodePtr __root, _NodePtr __x) _NOEXCEPT {
273273
_LIBCPP_ASSERT_INTERNAL(__root != nullptr, "Root of the tree shouldn't be null");
274274
_LIBCPP_ASSERT_INTERNAL(__x != nullptr, "Can't attach null node to a leaf");
275275
__x->__is_black_ = __x == __root;
@@ -645,9 +645,9 @@ public:
645645
__parent_pointer __parent_;
646646
bool __is_black_;
647647

648-
_LIBCPP_HIDE_FROM_ABI pointer __parent_unsafe() const { return static_cast<pointer>(__parent_); }
648+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 pointer __parent_unsafe() const { return static_cast<pointer>(__parent_); }
649649

650-
_LIBCPP_HIDE_FROM_ABI void __set_parent(pointer __p) { __parent_ = static_cast<__parent_pointer>(__p); }
650+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __set_parent(pointer __p) { __parent_ = static_cast<__parent_pointer>(__p); }
651651

652652

653653
// template <typename... Args> constexpr __tree_node_base(Args && ... args) =default;
@@ -960,19 +960,19 @@ public:
960960
_LIBCPP_HIDE_FROM_ABI allocator_type __alloc() const _NOEXCEPT { return allocator_type(__node_alloc()); }
961961

962962
private:
963-
_LIBCPP_HIDE_FROM_ABI size_type& size() _NOEXCEPT { return __size_; }
963+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 size_type& size() _NOEXCEPT { return __size_; }
964964

965965
public:
966-
_LIBCPP_HIDE_FROM_ABI const size_type& size() const _NOEXCEPT { return __size_; }
967-
_LIBCPP_HIDE_FROM_ABI value_compare& value_comp() _NOEXCEPT { return __value_comp_; }
968-
_LIBCPP_HIDE_FROM_ABI const value_compare& value_comp() const _NOEXCEPT { return __value_comp_; }
966+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const size_type& size() const _NOEXCEPT { return __size_; }
967+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_compare& value_comp() _NOEXCEPT { return __value_comp_; }
968+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const value_compare& value_comp() const _NOEXCEPT { return __value_comp_; }
969969

970970
public:
971-
_LIBCPP_HIDE_FROM_ABI __node_pointer __root() const _NOEXCEPT {
971+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_pointer __root() const _NOEXCEPT {
972972
return static_cast<__node_pointer>(__end_node()->__left_);
973973
}
974974

975-
_LIBCPP_HIDE_FROM_ABI __node_base_pointer* __root_ptr() const _NOEXCEPT {
975+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __node_base_pointer* __root_ptr() const _NOEXCEPT {
976976
return std::addressof(__end_node()->__left_);
977977
}
978978

@@ -1183,7 +1183,7 @@ public:
11831183
template <class _Key>
11841184
_LIBCPP_HIDE_FROM_ABI size_type __erase_multi(const _Key& __k);
11851185

1186-
_LIBCPP_HIDE_FROM_ABI void
1186+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
11871187
__insert_node_at(__parent_pointer __parent, __node_base_pointer& __child, __node_base_pointer __new_node) _NOEXCEPT;
11881188

11891189
template <class _Key>
@@ -1764,7 +1764,7 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_base_pointer& __tree<_Tp, _Co
17641764
}
17651765

17661766
template <class _Tp, class _Compare, class _Allocator>
1767-
void __tree<_Tp, _Compare, _Allocator>::__insert_node_at(
1767+
_LIBCPP_CONSTEXPR_SINCE_CXX26 void __tree<_Tp, _Compare, _Allocator>::__insert_node_at(
17681768
__parent_pointer __parent, __node_base_pointer& __child, __node_base_pointer __new_node) _NOEXCEPT {
17691769
__new_node->__left_ = nullptr;
17701770
__new_node->__right_ = nullptr;

libcxx/include/map

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -774,15 +774,15 @@ private:
774774
value_type __cc_;
775775

776776
public:
777-
_LIBCPP_HIDE_FROM_ABI value_type& __get_value() {
777+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_type& __get_value() {
778778
# if _LIBCPP_STD_VER >= 17
779779
return *std::launder(std::addressof(__cc_));
780780
# else
781781
return __cc_;
782782
# endif
783783
}
784784

785-
_LIBCPP_HIDE_FROM_ABI const value_type& __get_value() const {
785+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 const value_type& __get_value() const {
786786
# if _LIBCPP_STD_VER >= 17
787787
return *std::launder(std::addressof(__cc_));
788788
# else
@@ -791,6 +791,7 @@ public:
791791
}
792792

793793

794+
// TODO: possibly no longer needed
794795
/*
795796
Use this helper when the lifetime of __v may not have begun,
796797
so calling __v.__get_value() is not allowed

libcxx/include/stdexcept

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ public:
161161

162162
class _LIBCPP_EXPORTED_FROM_ABI out_of_range : public logic_error {
163163
public:
164-
_LIBCPP_HIDE_FROM_ABI explicit out_of_range(const string& __s) : logic_error(__s) {}
165-
_LIBCPP_HIDE_FROM_ABI explicit out_of_range(const char* __s) : logic_error(__s) {}
164+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit out_of_range(const string& __s) : logic_error(__s) {}
165+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 explicit out_of_range(const char* __s) : logic_error(__s) {}
166166

167167
# ifndef _LIBCPP_ABI_VCRUNTIME
168168
_LIBCPP_HIDE_FROM_ABI out_of_range(const out_of_range&) _NOEXCEPT = default;
@@ -246,7 +246,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
246246
# endif
247247
}
248248

249-
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range(const char* __msg) {
249+
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __throw_out_of_range(const char* __msg) {
250250
# if _LIBCPP_HAS_EXCEPTIONS
251251
throw out_of_range(__msg);
252252
# else

0 commit comments

Comments
 (0)