Skip to content

Commit 145bd51

Browse files
committed
Fix instantiation error in MSVC for recursive types when evaluating the conditional defaulted destructor.
1 parent db43fc9 commit 145bd51

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

include/boost/container/vector.hpp

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,28 @@ namespace container {
7676

7777
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
7878

79+
namespace dtl {
80+
81+
template<class Alloc, bool AllocV0 = (version<Alloc>::value == 0)>
82+
struct is_version_0_alloc_and_trivially_destructible
83+
: boost::move_detail::is_trivially_destructible<typename Alloc::value_type>
84+
{ };
85+
86+
template<bool AllocV0>
87+
struct is_version_0_alloc_and_trivially_destructible<void, AllocV0>
88+
{
89+
BOOST_STATIC_CONSTEXPR bool value = false;
90+
};
91+
92+
template<class Alloc>
93+
struct is_version_0_alloc_and_trivially_destructible<Alloc, false>
94+
{
95+
BOOST_STATIC_CONSTEXPR bool value = false;
96+
};
97+
98+
99+
} //namespace dtl {
100+
79101
template<class SizeType, class LimitSizeType>
80102
struct vec_on_type_overflow
81103
{
@@ -1224,7 +1246,7 @@ class vector
12241246
//! <b>Complexity</b>: Linear to the number of elements.
12251247
~vector() BOOST_NOEXCEPT_OR_NOTHROW
12261248
#if defined(BOOST_INTRUSIVE_CONCEPTS_BASED_OVERLOADING)
1227-
requires (dtl::version<allocator_type>::value != 0 || !::boost::move_detail::is_trivially_destructible<T>::value)
1249+
requires (!dtl::is_version_0_alloc_and_trivially_destructible<allocator_type>::value)
12281250
#endif
12291251
{
12301252
boost::container::destroy_alloc_n
@@ -1235,7 +1257,7 @@ class vector
12351257
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) && defined(BOOST_INTRUSIVE_CONCEPTS_BASED_OVERLOADING)
12361258
//Default destructor for normal links (allows conditional triviality)
12371259
~vector()
1238-
requires (dtl::version<allocator_type>::value == 0 && ::boost::move_detail::is_trivially_destructible<T>::value)
1260+
requires (dtl::is_version_0_alloc_and_trivially_destructible<allocator_type>::value)
12391261
= default;
12401262
#endif
12411263

0 commit comments

Comments
 (0)