Opened 7 years ago

Last modified 7 years ago

#11985 new Bugs

range: compiler-error sub_range copy-constructor workaround for MSVC

Reported by: Tobias Loew Owned by: Neil Groves
Milestone: To Be Determined Component: range
Version: Boost 1.61.0 Severity: Problem
Keywords: Cc:

Description (last modified by Tobias Loew)

Hi,

the following code generates an error when compiled with MSVC 11 (aka VS 2012)

    std::vector<int> arr;
    arr.push_back(42);
    boost::sub_range<std::vector<int>> ran = arr;
    boost::sub_range<std::vector<int>> ran_2 = ran;
    const boost::sub_range<std::vector<int>>& ran_ref = ran;
    boost::sub_range<std::vector<int>> ran_3 = ran_ref;

Error: libs\boost\boost\boost\range\iterator_range_core.hpp(69): error C2440: 'static_cast' : cannot convert from 'std::_Vector_const_iterator<_Myvec>' to 'std::_Vector_iterator<_Myvec>'

the reason is a BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500) ) in boost/range/sub_range.hpp at line 183 if I comment out the workaround everything compiles correct.

Tobias

Change History (1)

comment:1 by Tobias Loew, 7 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.