From 1c18f42e8316dc071c518983fb3ac45bcc301e89 Mon Sep 17 00:00:00 2001 From: Nathan Ridge Date: Thu, 30 May 2013 23:16:51 +0000 Subject: [PATCH] [range] Use correct iterator concepts when checking Boost.Range concepts (refs #6944). [SVN r84566] --- include/boost/range/concepts.hpp | 8 +++--- test/Jamfile.v2 | 1 + test/ticket_6944.cpp | 45 ++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 test/ticket_6944.cpp diff --git a/include/boost/range/concepts.hpp b/include/boost/range/concepts.hpp index 5965293..5a02a21 100644 --- a/include/boost/range/concepts.hpp +++ b/include/boost/range/concepts.hpp @@ -330,8 +330,8 @@ namespace boost { struct BidirectionalRangeConcept : ForwardRangeConcept { #if BOOST_RANGE_ENABLE_CONCEPT_ASSERT - BOOST_RANGE_CONCEPT_ASSERT((BidirectionalIteratorConcept)); - BOOST_RANGE_CONCEPT_ASSERT((BidirectionalIteratorConcept)); + BOOST_RANGE_CONCEPT_ASSERT((range_detail::BidirectionalIteratorConcept)); + BOOST_RANGE_CONCEPT_ASSERT((range_detail::BidirectionalIteratorConcept)); #endif }; @@ -348,8 +348,8 @@ namespace boost { struct RandomAccessRangeConcept : BidirectionalRangeConcept { #if BOOST_RANGE_ENABLE_CONCEPT_ASSERT - BOOST_RANGE_CONCEPT_ASSERT((RandomAccessIteratorConcept)); - BOOST_RANGE_CONCEPT_ASSERT((RandomAccessIteratorConcept)); + BOOST_RANGE_CONCEPT_ASSERT((range_detail::RandomAccessIteratorConcept)); + BOOST_RANGE_CONCEPT_ASSERT((range_detail::RandomAccessIteratorConcept)); #endif }; diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index d76c141..bcaa772 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -161,5 +161,6 @@ test-suite range : [ range-test ticket_5544_terminate_irange ] [ range-test ticket_5547 ] [ range-test ticket_5556_is_sorted_namespace ] + [ range-test ticket_6944 ] ; diff --git a/test/ticket_6944.cpp b/test/ticket_6944.cpp new file mode 100644 index 0000000..cbf3903 --- /dev/null +++ b/test/ticket_6944.cpp @@ -0,0 +1,45 @@ +// Boost.Range library +// +// Copyright Neil Groves 2011. Use, modification and +// distribution is subject to the Boost Software License, Version +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +// For more information, see http://www.boost.org/libs/range/ +// +#include +#include +#include +#include + +#include +#include + +#include + +namespace boost +{ + namespace + { + // Ticket 6944 - Some Range concepts use the incorrect Iterator concept + typedef std::vector::iterator iter_base; + struct iter : boost::iterator_adaptor {}; // will be deduced as random-access traversal but input category + typedef boost::iterator_range iter_range; + void test_ticket_6944() + { + BOOST_CONCEPT_ASSERT(( boost::RandomAccessRangeConcept )); + } + } +} + +boost::unit_test::test_suite* +init_unit_test_suite(int argc, char* argv[]) +{ + boost::unit_test::test_suite* test + = BOOST_TEST_SUITE( "RangeTestSuite.ticket_6944" ); + + test->add( BOOST_TEST_CASE( &boost::test_ticket_6944 ) ); + + return test; +}