[Boost-bugs] [Boost C++ Libraries] #6977: bug in conversion of mpl iterator category tags

Subject: [Boost-bugs] [Boost C++ Libraries] #6977: bug in conversion of mpl iterator category tags
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-06-10 05:46:56


#6977: bug in conversion of mpl iterator category tags
----------------------------------+-----------------------------------------
 Reporter: ramey | Owner: jfalcou
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: mpl
  Version: Boost 1.49.0 | Severity: Problem
 Keywords: mpl category convert |
----------------------------------+-----------------------------------------
 MPL documentation indicates that bidirectional_iterator_tag is convertible
 to random_access_iterator_tag. The following code shows that this is not
 true.
 {{{
 #include <boost/mpl/iterator_category.hpp>
 #include <boost/mpl/iterator_tags.hpp>

 #include <boost/mpl/print.hpp>
 #include <boost/mpl/assert.hpp>
 #include <boost/type_traits/is_convertible.hpp>

 using namespace boost::mpl;

 print<
     boost::is_convertible<
         bidirectional_iterator_tag,
         random_access_iterator_tag
>::type
> x5;

 BOOST_MPL_ASSERT((
     boost::is_convertible<
         bidirectional_iterator_tag,
         random_access_iterator_tag
>
 ));
 }}}

 The compile time output from this progam is:

 {{{
 1>------ Build started: Project: test_interval, Configuration: Debug Win32
 ------
 1>Compiling...
 1>test_multi_precision.cpp
 1>c:\boostrelease\boost\mpl\print.hpp(51) : warning C4308: negative
 integral constant converted to unsigned type
 1> c:\projects\boost
 projects\mpl\tests\test_multi_precision.cpp(15) : see reference to class
 template instantiation 'boost::mpl::print<T>' being compiled
 1> with
 1> [
 1> T=boost::integral_constant<bool,false>::type
 1> ]
 1>c:\projects\boost projects\mpl\tests\test_multi_precision.cpp(22) :
 error C2664: 'boost::mpl::assertion_failed' : cannot convert parameter 1
 from 'boost::mpl::failed ************boost::is_convertible<From,To>::*
 ***********' to 'boost::mpl::assert<false>::type'
 1> with
 1> [
 1> From=boost::mpl::bidirectional_iterator_tag,
 1> To=boost::mpl::random_access_iterator_tag
 1> ]
 1> No constructor could take the source type, or constructor
 overload resolution was ambiguous
 1>Build log was saved at "file://c:\Projects\Boost
 Projects\mpl\tests\vcide\Debug\BuildLog.htm"
 1>test_interval - 1 error(s), 1 warning(s)
 ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
 ==========
 }}}

 Robert Ramey

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6977>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:09 UTC