From ea3fa755a14d7fb98bb6b85e9d20d3941403dd39 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Fri, 5 Jul 2019 07:14:25 -0700 Subject: [PATCH] Fix regression reported in #23 (#24) * Add test from issue 23. Refs #23. * Fix ptr_vector regression with incomplete types. Refs #23. * Enable CI for feature branches --- include/boost/ptr_container/ptr_vector.hpp | 27 ++++++++++++++++------ test/Jamfile.v2 | 1 + test/issue_23.cpp | 18 +++++++++++++++ 3 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 test/issue_23.cpp diff --git a/include/boost/ptr_container/ptr_vector.hpp b/include/boost/ptr_container/ptr_vector.hpp index d3ecdf88..944580bc 100644 --- a/include/boost/ptr_container/ptr_vector.hpp +++ b/include/boost/ptr_container/ptr_vector.hpp @@ -19,6 +19,8 @@ #include #include #include +#include +#include #if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED) #pragma GCC diagnostic push @@ -32,16 +34,27 @@ namespace boost < class T, class CloneAllocator = heap_clone_allocator, - class Allocator = std::allocator::type> + class Allocator = void > class ptr_vector : public - ptr_sequence_adapter< T, std::vector< - typename ptr_container_detail::void_ptr::type,Allocator>, - CloneAllocator > + ptr_sequence_adapter< T, + std::vector< + typename ptr_container_detail::void_ptr::type, + typename boost::mpl::if_, + std::allocator::type>, Allocator>::type + >, + CloneAllocator > { - typedef ptr_sequence_adapter< T, std::vector< - typename ptr_container_detail::void_ptr::type,Allocator>, - CloneAllocator > + typedef + + ptr_sequence_adapter< T, + std::vector< + typename ptr_container_detail::void_ptr::type, + typename boost::mpl::if_, + std::allocator::type>, Allocator>::type + >, + CloneAllocator > + base_class; typedef ptr_vector this_type; diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 78b1b8a7..9a3e8908 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -43,4 +43,5 @@ test-suite ptr_container : [ compile const_element_containers.cpp ] # [ sc-test null_filter_iterator ] + [ compile issue_23.cpp ] ; diff --git a/test/issue_23.cpp b/test/issue_23.cpp new file mode 100644 index 00000000..66e8b817 --- /dev/null +++ b/test/issue_23.cpp @@ -0,0 +1,18 @@ +// Use, modification and distribution is subject to the +// Boost Software License, Version 1.0. +// http://www.boost.org/LICENSE_1_0.txt + +#include + +template struct Foo +{ + static void test(boost::ptr_vector >& /*t*/) + { + } +}; + +int main() +{ + boost::ptr_vector > ptr; + return 0; +}