diff --git a/srcpkgs/boost/patches/0003-unordered-valid-after-move.patch b/srcpkgs/boost/patches/0003-unordered-valid-after-move.patch new file mode 100644 index 00000000000..da065fc6270 --- /dev/null +++ b/srcpkgs/boost/patches/0003-unordered-valid-after-move.patch @@ -0,0 +1,175 @@ +diff -urN boost_1_80_0/boost/unordered/detail/fca.hpp boost_1_80_1/boost/unordered/detail/fca.hpp +--- boost_1_80_0/boost/unordered/detail/fca.hpp 2022-08-03 22:47:16.000000000 -0400 ++++ boost_1_80_1/boost/unordered/detail/fca.hpp 2022-08-24 19:44:43.139787681 -0400 +@@ -646,7 +646,7 @@ + + size_type bucket_count() const { return size_; } + +- iterator begin() const { return ++at(size_); } ++ iterator begin() const { return size_ == 0 ? end() : ++at(size_); } + + iterator end() const + { +@@ -660,6 +660,10 @@ + + local_iterator begin(size_type n) const + { ++ if (size_ == 0) { ++ return this->end(n); ++ } ++ + return local_iterator( + (buckets + static_cast(n))->next); + } +@@ -670,12 +674,16 @@ + + iterator at(size_type n) const + { +- std::size_t const N = group::N; ++ if (size_ > 0) { ++ std::size_t const N = group::N; + +- iterator pbg(buckets + static_cast(n), +- groups + static_cast(n / N)); ++ iterator pbg(buckets + static_cast(n), ++ groups + static_cast(n / N)); + +- return pbg; ++ return pbg; ++ } else { ++ return this->end(); ++ } + } + + span raw() +diff -urN boost_1_80_0/boost/unordered/detail/implementation.hpp boost_1_80_1/boost/unordered/detail/implementation.hpp +--- boost_1_80_0/boost/unordered/detail/implementation.hpp 2022-08-03 22:47:16.000000000 -0400 ++++ boost_1_80_1/boost/unordered/detail/implementation.hpp 2022-08-24 19:44:43.139787681 -0400 +@@ -2054,12 +2054,14 @@ + + std::size_t bucket_size(std::size_t index) const + { +- bucket_iterator itb = buckets_.at(index); +- node_pointer n = itb->next; + std::size_t count = 0; +- while (n) { +- ++count; +- n = n->next; ++ if (size_ > 0) { ++ bucket_iterator itb = buckets_.at(index); ++ node_pointer n = itb->next; ++ while (n) { ++ ++count; ++ n = n->next; ++ } + } + return count; + } +@@ -2420,11 +2422,14 @@ + node_pointer find_node_impl( + Key const& x, bucket_iterator itb) const + { +- key_equal const& pred = this->key_eq(); +- node_pointer p = itb->next; +- for (; p; p = p->next) { +- if (pred(x, extractor::extract(p->value()))) { +- break; ++ node_pointer p = node_pointer(); ++ if (itb != buckets_.end()) { ++ key_equal const& pred = this->key_eq(); ++ p = itb->next; ++ for (; p; p = p->next) { ++ if (pred(x, extractor::extract(p->value()))) { ++ break; ++ } + } + } + return p; +@@ -2453,11 +2458,13 @@ + inline iterator transparent_find( + Key const& k, Hash const& h, Pred const& pred) const + { +- std::size_t const key_hash = h(k); +- bucket_iterator itb = buckets_.at(buckets_.position(key_hash)); +- for (node_pointer p = itb->next; p; p = p->next) { +- if (BOOST_LIKELY(pred(k, extractor::extract(p->value())))) { +- return iterator(p, itb); ++ if (size_ > 0) { ++ std::size_t const key_hash = h(k); ++ bucket_iterator itb = buckets_.at(buckets_.position(key_hash)); ++ for (node_pointer p = itb->next; p; p = p->next) { ++ if (BOOST_LIKELY(pred(k, extractor::extract(p->value())))) { ++ return iterator(p, itb); ++ } + } + } + +@@ -2467,11 +2474,13 @@ + template + node_pointer* find_prev(Key const& key, bucket_iterator itb) + { +- key_equal pred = this->key_eq(); +- for (node_pointer* pp = boost::addressof(itb->next); *pp; +- pp = boost::addressof((*pp)->next)) { +- if (pred(key, extractor::extract((*pp)->value()))) { +- return pp; ++ if (size_ > 0) { ++ key_equal pred = this->key_eq(); ++ for (node_pointer* pp = boost::addressof(itb->next); *pp; ++ pp = boost::addressof((*pp)->next)) { ++ if (pred(key, extractor::extract((*pp)->value()))) { ++ return pp; ++ } + } + } + typedef node_pointer* node_pointer_pointer; +diff -urN boost_1_80_0/boost/unordered/unordered_map.hpp boost_1_80_1/boost/unordered/unordered_map.hpp +--- boost_1_80_0/boost/unordered/unordered_map.hpp 2022-08-03 22:47:16.000000000 -0400 ++++ boost_1_80_1/boost/unordered/unordered_map.hpp 2022-08-24 19:44:43.139787681 -0400 +@@ -2069,6 +2069,10 @@ + template + float unordered_map::load_factor() const BOOST_NOEXCEPT + { ++ if (table_.size_ == 0) { ++ return 0.0f; ++ } ++ + BOOST_ASSERT(table_.bucket_count() != 0); + return static_cast(table_.size_) / + static_cast(table_.bucket_count()); +@@ -2506,6 +2510,10 @@ + template + float unordered_multimap::load_factor() const BOOST_NOEXCEPT + { ++ if (table_.size_ == 0) { ++ return 0.0f; ++ } ++ + BOOST_ASSERT(table_.bucket_count() != 0); + return static_cast(table_.size_) / + static_cast(table_.bucket_count()); +diff -urN boost_1_80_0/boost/unordered/unordered_set.hpp boost_1_80_1/boost/unordered/unordered_set.hpp +--- boost_1_80_0/boost/unordered/unordered_set.hpp 2022-08-03 22:47:16.000000000 -0400 ++++ boost_1_80_1/boost/unordered/unordered_set.hpp 2022-08-24 19:44:43.139787681 -0400 +@@ -1586,6 +1586,10 @@ + template + float unordered_set::load_factor() const BOOST_NOEXCEPT + { ++ if (table_.size_ == 0) { ++ return 0.0f; ++ } ++ + BOOST_ASSERT(table_.bucket_count() != 0); + return static_cast(table_.size_) / + static_cast(table_.bucket_count()); +@@ -1986,6 +1990,10 @@ + template + float unordered_multiset::load_factor() const BOOST_NOEXCEPT + { ++ if (table_.size_ == 0) { ++ return 0.0f; ++ } ++ + BOOST_ASSERT(table_.bucket_count() != 0); + return static_cast(table_.size_) / + static_cast(table_.bucket_count()); diff --git a/srcpkgs/boost/template b/srcpkgs/boost/template index 265ed8a3898..a3da2dc4ca2 100644 --- a/srcpkgs/boost/template +++ b/srcpkgs/boost/template @@ -1,7 +1,7 @@ # Template file for 'boost' pkgname=boost version=1.80.0 -revision=4 +revision=5 hostmakedepends="which bzip2-devel icu-devel python3-devel pkg-config" makedepends="zlib-devel bzip2-devel icu-devel python3-devel liblzma-devel libzstd-devel"