id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 12895,VS 2012: zip_iterator dereference causes a compiler error,daniel.kruegler@…,jeffrey.hellrung,"Using Visual Studio 2012 (vc110), any direct or indirect usage of the dereference operation of zip_iterator produces now a compiler error, a simple reproducer is the following example: {{{ #include ""boost/iterator/zip_iterator.hpp"" int main() { typedef boost::tuple iterators_t; char chars[] = ""abc""; iterators_t iters(chars + 0, chars + 3); boost::iterators::zip_iterator zip(iters); *zip; } }}} which results in the following compiler output: {{{ 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(364): error C2825: '_Iter': must be a class or namespace when followed by '::' 1> c:\projects\thirdparty\boost_1_63_0\boost\iterator\iterator_traits.hpp(28) : see reference to class template instantiation 'std::iterator_traits<_Iter>' being compiled 1> with 1> [ 1> _Iter=char *const 1> ] 1> c:\projects\thirdparty\boost_1_63_0\boost\iterator\zip_iterator.hpp(90) : see reference to class template instantiation 'boost::iterators::iterator_reference' being compiled 1> with 1> [ 1> Iterator=char *const 1> ] 1> c:\projects\thirdparty\boost_1_63_0\boost\utility\result_of.hpp(190) : see reference to class template instantiation 'boost::iterators::detail::dereference_iterator::result<>' being compiled 1> with 1> [ 1> =boost::iterators::detail::dereference_iterator (char *const &) 1> ] 1> c:\projects\thirdparty\boost_1_63_0\boost\utility\result_of.hpp(197) : see reference to class template instantiation 'boost::detail::result_of_nested_result' being compiled 1> with 1> [ 1> F=boost::iterators::detail::dereference_iterator, 1> FArgs=boost::iterators::detail::dereference_iterator (char *const &) 1> ] 1> c:\projects\thirdparty\boost_1_63_0\boost\utility\detail\result_of_iterate.hpp(37) : see reference to class template instantiation 'boost::detail::tr1_result_of_impl' being compiled 1> with 1> [ 1> F=boost::iterators::detail::dereference_iterator, 1> FArgs=boost::iterators::detail::dereference_iterator (char *const &), 1> HasResultType=false 1> ] 1> c:\projects\thirdparty\boost_1_63_0\boost\utility\detail\result_of_iterate.hpp(160) : see reference to class template instantiation 'boost::tr1_result_of' being compiled 1> with 1> [ 1> F=boost::iterators::detail::dereference_iterator (char *const &) 1> ] 1> c:\projects\thirdparty\boost_1_63_0\boost\fusion\view\transform_view\detail\apply_transform_result.hpp(31) : see reference to class template instantiation 'boost::result_of' being compiled 1> with 1> [ 1> F=boost::iterators::detail::dereference_iterator (char *const &) 1> ] 1> c:\projects\thirdparty\boost_1_63_0\boost\mpl\aux_\preprocessed\plain\apply_wrap.hpp(39) : see reference to class template instantiation 'boost::fusion::detail::apply_transform_result::apply' being compiled 1> with 1> [ 1> F=boost::iterators::detail::dereference_iterator, 1> T0=char *const & 1> ] 1> c:\projects\thirdparty\boost_1_63_0\boost\mpl\aux_\preprocessed\plain\apply.hpp(43) : see reference to class template instantiation 'boost::mpl::apply_wrap1' being compiled 1> with 1> [ 1> F=boost::fusion::detail::apply_transform_result, 1> T1=char *const & 1> ] 1> c:\projects\thirdparty\boost_1_63_0\boost\mpl\aux_\preprocessed\plain\apply.hpp(51) : see reference to class template instantiation 'boost::mpl::apply1' being compiled 1> with 1> [ 1> F=boost::fusion::detail::apply_transform_result, 1> T1=char *const & 1> ] 1> c:\projects\thirdparty\boost_1_63_0\boost\fusion\view\transform_view\detail\deref_impl.hpp(38) : see reference to class template instantiation 'boost::mpl::apply' being compiled 1> with 1> [ 1> F=boost::fusion::detail::apply_transform_result, 1> T1=char *const & 1> ] 1> c:\projects\thirdparty\boost_1_63_0\boost\fusion\iterator\deref.hpp(54) : see reference to class template instantiation 'boost::fusion::extension::deref_impl::apply' being compiled 1> with 1> [ 1> Iterator=boost::fusion::transform_view_iterator,boost::iterators::detail::dereference_iterator> 1> ] 1> c:\projects\thirdparty\boost_1_63_0\boost\fusion\adapted\boost_tuple\detail\build_cons.hpp(53) : see reference to class template instantiation 'boost::fusion::result_of::deref' being compiled 1> with 1> [ 1> Iterator=boost::fusion::transform_view_iterator,boost::iterators::detail::dereference_iterator> 1> ] 1> c:\projects\thirdparty\boost_1_63_0\boost\fusion\adapted\boost_tuple\detail\build_cons.hpp(52) : while compiling class template member function 'boost::tuples::cons boost::fusion::detail::build_tuple_cons::call(const First &,const Last &)' 1> with 1> [ 1> HT=char &, 1> TT=boost::tuples::cons,boost::mpl::int_<1>>,boost::fusion::single_view_iterator,boost::mpl::int_<1>>>::type>, 1> First=boost::fusion::transform_view_iterator,boost::iterators::detail::dereference_iterator>, 1> Last=boost::fusion::transform_view_iterator,boost::iterators::detail::dereference_iterator> 1> ] 1> c:\projects\thirdparty\boost_1_63_0\boost\fusion\adapted\boost_tuple\detail\convert_impl.hpp(43) : see reference to function template instantiation 'boost::tuples::cons boost::fusion::detail::build_tuple_cons::call(const First &,const Last &)' being compiled 1> with 1> [ 1> HT=char &, 1> TT=boost::tuples::cons,boost::mpl::int_<1>>,boost::fusion::single_view_iterator,boost::mpl::int_<1>>>::type>, 1> First=boost::fusion::transform_view_iterator,boost::iterators::detail::dereference_iterator>, 1> Last=boost::fusion::transform_view_iterator,boost::iterators::detail::dereference_iterator> 1> ] 1> c:\projects\thirdparty\boost_1_63_0\boost\fusion\adapted\boost_tuple\detail\convert_impl.hpp(37) : see reference to class template instantiation 'boost::fusion::detail::build_tuple_cons' being compiled 1> with 1> [ 1> First=boost::fusion::transform_view_iterator,boost::iterators::detail::dereference_iterator>, 1> Last=boost::fusion::transform_view_iterator,boost::iterators::detail::dereference_iterator> 1> ] 1> c:\projects\thirdparty\boost_1_63_0\boost\fusion\sequence\convert.hpp(37) : see reference to class template instantiation 'boost::fusion::extension::convert_impl::apply' being compiled 1> with 1> [ 1> Sequence=const boost::fusion::transform_view 1> ] 1> c:\projects\thirdparty\boost_1_63_0\boost\iterator\zip_iterator.hpp(214) : see reference to class template instantiation 'boost::fusion::result_of::convert' being compiled 1> with 1> [ 1> Tag=tag, 1> Sequence=const boost::fusion::transform_view 1> ] 1> c:\projects\thirdparty\boost_1_63_0\boost\iterator\zip_iterator.hpp(289) : see reference to function template instantiation 'reference boost::iterators::detail::converter::call>(Seq)' being compiled 1> with 1> [ 1> reference=reference, 1> Sequence1=const iterators_t, 1> Sequence2=boost::iterators::detail::dereference_iterator, 1> Seq=boost::fusion::transform_view 1> ] 1> c:\projects\thirdparty\boost_1_63_0\boost\iterator\zip_iterator.hpp(289) : see reference to function template instantiation 'reference boost::iterators::detail::converter::call>(Seq)' being compiled 1> with 1> [ 1> reference=reference, 1> Sequence1=const iterators_t, 1> Sequence2=boost::iterators::detail::dereference_iterator, 1> Seq=boost::fusion::transform_view 1> ] 1> c:\projects\thirdparty\boost_1_63_0\boost\iterator\zip_iterator.hpp(284) : while compiling class template member function 'boost::tuples::cons boost::iterators::zip_iterator::dereference(void) const' 1> with 1> [ 1> HT=char &, 1> TT=boost::tuples::cons,boost::mpl::int_<1>>,boost::fusion::single_view_iterator,boost::mpl::int_<1>>>::type>, 1> IteratorTuple=iterators_t 1> ] 1> c:\projects\thirdparty\boost_1_63_0\boost\iterator\iterator_facade.hpp(549) : see reference to function template instantiation 'boost::tuples::cons boost::iterators::zip_iterator::dereference(void) const' being compiled 1> with 1> [ 1> HT=char &, 1> TT=boost::tuples::cons,boost::mpl::int_<1>>,boost::fusion::single_view_iterator,boost::mpl::int_<1>>>::type>, 1> IteratorTuple=iterators_t 1> ] 1> h:\develop\cpp\c++0x\vssandbox - 2011\main.cpp(8) : see reference to class template instantiation 'boost::iterators::zip_iterator' being compiled 1> with 1> [ 1> IteratorTuple=iterators_t 1> ] 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(364): error C2039: 'iterator_category' : is not a member of '`global namespace'' 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(364): error C2146: syntax error : missing ';' before identifier 'iterator_category' 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(364): error C2602: 'std::iterator_traits<_Iter>::iterator_category' is not a member of a base class of 'std::iterator_traits<_Iter>' 1> with 1> [ 1> _Iter=char *const 1> ] 1> c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(364) : see declaration of 'std::iterator_traits<_Iter>::iterator_category' 1> with 1> [ 1> _Iter=char *const 1> ] 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(364): error C2868: 'std::iterator_traits<_Iter>::iterator_category' : illegal syntax for using-declaration; expected qualified-name 1> with 1> [ 1> _Iter=char *const 1> ] 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(365): error C2825: '_Iter': must be a class or namespace when followed by '::' 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(365): error C2039: 'value_type' : is not a member of '`global namespace'' 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(365): error C2146: syntax error : missing ';' before identifier 'value_type' 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(365): error C2602: 'std::iterator_traits<_Iter>::value_type' is not a member of a base class of 'std::iterator_traits<_Iter>' 1> with 1> [ 1> _Iter=char *const 1> ] 1> c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(365) : see declaration of 'std::iterator_traits<_Iter>::value_type' 1> with 1> [ 1> _Iter=char *const 1> ] 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(365): error C2868: 'std::iterator_traits<_Iter>::value_type' : illegal syntax for using-declaration; expected qualified-name 1> with 1> [ 1> _Iter=char *const 1> ] 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(366): error C2825: '_Iter': must be a class or namespace when followed by '::' 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(366): error C2039: 'difference_type' : is not a member of '`global namespace'' 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(366): error C2146: syntax error : missing ';' before identifier 'difference_type' 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(366): error C2602: 'std::iterator_traits<_Iter>::difference_type' is not a member of a base class of 'std::iterator_traits<_Iter>' 1> with 1> [ 1> _Iter=char *const 1> ] 1> c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(366) : see declaration of 'std::iterator_traits<_Iter>::difference_type' 1> with 1> [ 1> _Iter=char *const 1> ] 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(366): error C2868: 'std::iterator_traits<_Iter>::difference_type' : illegal syntax for using-declaration; expected qualified-name 1> with 1> [ 1> _Iter=char *const 1> ] 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(368): error C2825: '_Iter': must be a class or namespace when followed by '::' 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(368): error C2039: 'pointer' : is not a member of '`global namespace'' 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(368): error C2146: syntax error : missing ';' before identifier 'pointer' 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(368): error C2602: 'std::iterator_traits<_Iter>::pointer' is not a member of a base class of 'std::iterator_traits<_Iter>' 1> with 1> [ 1> _Iter=char *const 1> ] 1> c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(368) : see declaration of 'std::iterator_traits<_Iter>::pointer' 1> with 1> [ 1> _Iter=char *const 1> ] 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(368): error C2868: 'std::iterator_traits<_Iter>::pointer' : illegal syntax for using-declaration; expected qualified-name 1> with 1> [ 1> _Iter=char *const 1> ] 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(369): error C2825: '_Iter': must be a class or namespace when followed by '::' 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(369): error C2039: 'reference' : is not a member of '`global namespace'' 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(369): error C2146: syntax error : missing ';' before identifier 'reference' 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(369): error C2602: 'std::iterator_traits<_Iter>::reference' is not a member of a base class of 'std::iterator_traits<_Iter>' 1> with 1> [ 1> _Iter=char *const 1> ] 1> c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(369) : see declaration of 'std::iterator_traits<_Iter>::reference' 1> with 1> [ 1> _Iter=char *const 1> ] 1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xutility(369): error C2868: 'std::iterator_traits<_Iter>::reference' : illegal syntax for using-declaration; expected qualified-name 1> with 1> [ 1> _Iter=char *const 1> ] 1>c:\projects\thirdparty\boost_1_63_0\boost\fusion\adapted\boost_tuple\detail\build_cons.hpp(53): error C2440: 'initializing' : cannot convert from 'char *const ' to 'char &' ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ========== }}} The problem seems rather severe to me and may occur even though the user-code didn't actually use zip_iterator directly. In fact I became aware of the problem when a colleague asked me why the following code would no longer be accepted when we switched from Boost 1.57 to Boost 1.63: {{{ #include ""boost/range/combine.hpp"" int main() { int a[] = { 1, 2, 3 }; int b[] = { 4, 5, 6 }; for(const auto& p : boost::combine(a, b)) { } } }}} According to my not fully completed analysis, the problem is caused, because the current implementation of zip_iterator::dereference relies on a recently introduced feature of std::iterator_traits being now sfinae-friendly (See LWG issue 2408), which is not the case in the VS 2012 Standard Library. This assumption gets support by the fact that both VS 2015 and VS 2017 accept the code (And both compiler's Standard Libraries provide sfinae-friendly iterator_traits). ",Bugs,new,To Be Determined,iterator,Boost 1.63.0,Problem,,,