Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4874: multi_array compile errors using Visual C++ 2010 in debug mode
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-09-06 10:28:27
#4874: multi_array compile errors using Visual C++ 2010 in debug mode
-------------------------------+--------------------------------------------
Reporter: chrislu | Owner: garcia
Type: Bugs | Status: reopened
Milestone: To Be Determined | Component: multi_array
Version: Boost 1.47.0 | Severity: Showstopper
Resolution: | Keywords: multi_array, Visual Studio 2010, Visual C++ 2010
-------------------------------+--------------------------------------------
Changes (by a.elovikov@â¦):
* status: closed => reopened
* resolution: fixed =>
Comment:
Hi all.
I see the same error when using Intel Compiler because it uses the same
headers as MSVC does.
{{{
$ icl.exe /nologo
-Fo"libs/multi_array/test/../../../bin.v2/libs/multi_array/test/assert.test
/intel-win/debug/threading-multi/assert.obj" -TP /Z7 /Od /Ob0 /W3 /GR /MDd
/Zc:forScope /Zc:wchar_t /Qwn5 /Qwd985 -Qoption,c,--arg_dep_lookup
-D_SECURE_SCL=0 -Qoption,cpp,--arg_dep_lookup -Qpchi- /wd4675 /EHs -c
-DBOOST_ALL_NO_LIB=1 -DBOOST_TEST_NO_AUTO_LINK=1
"-Ilibs/multi_array/test/../../.." "libs/multi_array/test/assert.cpp"
assert.cpp
libs/multi_array/test/../../../boost/test/utils/basic_cstring/basic_cstring.hpp(60):
warning #66: enumeration value is out of "int" range
enum npos_type { npos = static_cast<size_type>(-1) };
^
c:/Program files (x86)/Microsoft Visual Studio
10.0/VC/include/xutility(2215): error: no instance of overloaded function
"std::_Copy_impl" matches the argument list
argument types are:
(boost::detail::multi_array::array_iterator<int, const int *,
boost::mpl::size_t<2Ui64>,
boost::detail::multi_array::const_sub_array<int, 1Ui64, const int *>,
boost::random_access_traversal_tag>,
boost::detail::multi_array::array_iterator<int, const int *,
boost::mpl::size_t<2Ui64>,
boost::detail::multi_array::const_sub_array<int, 1Ui64, const
int *>, boost::random_access_traversal_tag>,
boost::detail::multi_array::array_iterator<int, int *,
boost::mpl::size_t<2Ui64>,
boost::detail::multi_array::sub_array<int, 1Ui64>,
boost::random_access_traversal_tag>,
boost::detail::iterator_category_with_traversal<std::input_iterator_tag,
boost::random_access_traversal_tag>,
boost::detail::iterator_category_with_traversal<std::input_iterator_tag,
boost::random_access_traversal_tag>)
return (_Copy_impl(_First, _Last,
^
detected during:
instantiation of "_OutIt std::_Copy_impl(_InIt, _InIt, _OutIt,
std::tr1::false_type) [with
_InIt=boost::detail::multi_array::array_iterator<int, const int *,
boost::mpl::size_t<2Ui64>,
boost::detail::multi_array::const_sub_array<int, 1Ui64, const int *>,
boost::random_access_traversal_tag>,
_OutIt=boost::detail::multi_array::array_iterator<int, int *,
boost::mpl::size_t<2Ui64>, boost::detail::multi_array::sub_array<int,
1Ui64>, boost::random_access_traversal_tag>]" at line 2227
instantiation of "_OutIt std::copy(_InIt, _InIt, _OutIt) [with
_InIt=boost::detail::multi_array::array_iterator<int, const int *,
boost::mpl::size_t<2Ui64>,
boost::detail::multi_array::const_sub_array<int, 1Ui64, const int *>,
boost::random_access_traversal_tag>,
_OutIt=boost::detail::multi_array::array_iterator<int, int *,
boost::mpl::size_t<2Ui64>, boost::detail::multi_array::sub_array<int,
1Ui64>, boost::random_access_traversal_tag>]" at line 490 of
"libs/multi_array/test/../../../boost/multi_array/multi_array_ref.hpp"
instantiation of "boost::multi_array_ref<T, NumDims>
&boost::multi_array_ref<T, NumDims>::operator=(const ConstMultiArray &)
[with T=int, NumDims=2Ui64, ConstMultiArray=boost::multi_array<int, 2Ui64,
std::allocator<int>>]" at line 377 of
"libs/multi_array/test/../../../boost/multi_array.hpp"
instantiation of "boost::multi_array<T, NumDims, Allocator>
&boost::multi_array<T, NumDims, Allocator>::operator=(const
boost::multi_array<T, NumDims, Allocator> &) [with T=int, NumDims=2Ui64,
Allocator=std::allocator<int>]" at line 52 of
"libs/multi_array/test/assert.cpp"
compilation aborted for libs/multi_array/test/assert.cpp (code 2)
}}}
But BOOST_MSVC is defined only in boost/config/compiler/visualc.hpp and
left undefined in case of icl:
{{{
$ icl.exe /nologo
-Fo"libs/multi_array/test/../../../bin.v2/libs/multi_array/test/assert.test
/intel-win/debug/threading-multi/assert.obj" -TP /Z7 /Od /Ob0 /W3 /GR /MDd
/Zc:forScope /Zc:wchar_t /Qwn5 /Qwd985 -Qoption,c,--arg_dep_lookup
-D_SECURE_SCL=0 -Qoption,cpp,--arg_dep_lookup -Qpchi- /wd4675 /EHs -c
-DBOOST_ALL_NO_LIB=1 -DBOOST_TEST_NO_AUTO_LINK=1
"-Ilibs/multi_array/test/../../.." "libs/multi_array/test/assert.cpp" -E
-QdD | grep -e "BOOST_MSVC"
assert.cpp
#define BOOST_MSVC6_MEMBER_TEMPLATES
#define BOOST_MSVC_WORKAROUND_GUARD 1
#define BOOST_MSVC_FULL_VER_WORKAROUND_GUARD 1
#define BOOST_MSVC_TYPENAME typename
#define BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(trait,name,default_) template<
typename T, typename fallback_ = boost::mpl::bool_<default_> > struct
trait { struct gcc_3_2_wknd { template< typename U > static
boost::mpl::aux::yes_tag test( boost::mpl::aux::type_wrapper<U> const
volatile* , boost::mpl::aux::type_wrapper<BOOST_MSVC_TYPENAME U::name>* =
0 ); static boost::mpl::aux::no_tag test(...); }; typedef
boost::mpl::aux::type_wrapper<T> t_; BOOST_STATIC_CONSTANT(bool, value =
sizeof(gcc_3_2_wknd::test(static_cast<t_*>(0))) ==
sizeof(boost::mpl::aux::yes_tag) ); typedef boost::mpl::bool_<value> type;
};
}}}
I suppose that the correct define to check is _MSC_VER which is defined
when using Intel Compiler. The following seems to fix it for me:
{{{
$ diff -Naur boost/multi_array/base.hpp{.orig,}
--- boost/multi_array/base.hpp.orig 2012-09-06 17:18:17.497270700
+0700
+++ boost/multi_array/base.hpp 2012-09-06 17:21:22.735770700 +0700
@@ -256,7 +256,7 @@
// MSVC 2010 is broken in debug mode: it requires
// that an Output Iterator have output_iterator_tag in its
iterator_category if
// that iterator is not bidirectional_iterator or random_access_iterator.
-#if BOOST_WORKAROUND(BOOST_MSVC, >= 1600)
+#if BOOST_WORKAROUND(_MSC_VER, >= 1600)
struct mutable_iterator_tag
: boost::random_access_traversal_tag, std::input_iterator_tag
{
@@ -314,7 +314,7 @@
//
// iterator support
//
-#if BOOST_WORKAROUND(BOOST_MSVC, >= 1600)
+#if BOOST_WORKAROUND(_MSC_VER, >= 1600)
// Deal with VC 2010 output_iterator_tag requirement
typedef array_iterator<T,T*,mpl::size_t<NumDims>,reference,
mutable_iterator_tag> iterator;
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/4874#comment:36> 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:10 UTC