[Boost-bugs] [Boost C++ Libraries] #9431: Problem compiling zip_iterator with clang and C++11

Subject: [Boost-bugs] [Boost C++ Libraries] #9431: Problem compiling zip_iterator with clang and C++11
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-11-25 20:13:00


#9431: Problem compiling zip_iterator with clang and C++11
------------------------------+------------------------------
 Reporter: jonathan.jones@… | Owner: jeffrey.hellrung
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: iterator
  Version: Boost 1.49.0 | Severity: Problem
 Keywords: |
------------------------------+------------------------------
 The following code fails to compile on OSX 10.8.5 with Xcode 5.0.1 and
 Boost 1.49.0. This is not real world code, but it demonstrates the
 problem I'm facing.

 {{{
 #include <boost/iterator/zip_iterator.hpp>

 template<typename T>
 void foo()
 {
     boost::zip_iterator<boost::tuple<T*> > iter;
     std::fill(iter, iter, boost::make_tuple(T()));
 }

 void bar()
 {
     foo<int>();
 }
 }}}

 Here are the commands I used to compile (if I drop "-stdlib=libc++" from
 the compile line, the code compiles just fine):

 {{{
 setenv DEVELOPER_DIR /Applications/Xcode5.0.1.app/Contents/Developer
 xcrun -sdk macosx10.8 clang++ -c zip_iterator.cpp -I<boost-path>/include
 -std=c++11 -stdlib=libc++
 }}}

 and here is a heavily formatted snippet of the key error:

 {{{
 /Applications/Xcode5.0.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/algorithm:1824:1:
 note: candidate function
     [with _RandomAccessIterator =
 boost::zip_iterator<boost::tuples::tuple<int *> >, _Tp =
 boost::tuples::tuple<int>]
 not viable: no known conversion from
     'typename iterator_traits<zip_iterator<tuple<int *> >
>::iterator_category'
     (aka
 'boost::detail::iterator_category_with_traversal<std::__1::input_iterator_tag,
 boost::random_access_traversal_tag>')
 to
     'std::__1::random_access_iterator_tag'
 for 4th argument
     __fill(_RandomAccessIterator __first, _RandomAccessIterator __last,
 const _Tp& __value_, random_access_iterator_tag)
 }}}

 It appears as if the zip_iterator is not being converted to the correct
 iterator tag, which is why no calls to std::fill match.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9431>
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:14 UTC