Opened 8 years ago

Last modified 8 years ago

#9984 new Bugs

range iterator failing to model forward_iterator

Reported by: Akim Demaille <akim.demaille@…> Owned by: jeffrey.hellrung
Milestone: To Be Determined Component: iterator
Version: Boost 1.55.0 Severity: Problem
Keywords: clang Cc: flast@…

Description

The following code snippet passes successfully with GCC 4.9, but Clang 3.5 (installed from MacPorts) fails to accept std::next.

The symptoms are somewhat alike #9431, but I have no idea if it's the same issue. According to the code of irange, I guess the problem is rather with Boost.Iterator.

$ cat bar.cc
#include <boost/range/irange.hpp>

int main()
{
  auto range = boost::irange<int>(0, 10);
  auto i = std::begin(range);
  auto j = std::next(i);
  std::cerr << *j << std::endl;
}
$ clang++-mp-3.5 -std=c++11 -I /opt/local/include bar.cc
bar.cc:7:12: error: no matching function for call to 'next'
  auto j = std::next(i);
           ^~~~~~~~~
/opt/local/libexec/llvm-3.5/bin/../include/c++/v1/iterator:514:25: note: candidate template
      ignored: disabled by 'enable_if' [with _ForwardIter =
      boost::range_detail::integer_iterator<int>]
     typename enable_if<__is_forward_iterator<_ForwardIter>::value>::type* = 0)
                        ^
1 error generated.
$ g++-mp-4.9 -std=c++11 -I /opt/local/include bar.cc

Change History (1)

comment:1 by Kohei Takahashi <flast@…>, 8 years ago

Cc: flast@… added

It seems that is already fixed in 1.56.

Here are results with online compiler.
1.55: ttp://melpon.org/wandbox/permlink/5XdQJxBGeriugOHI
1.56: ttp://melpon.org/wandbox/permlink/M7c7ohFJXA69MAFw
(trac rejects http:// as a spam ...)

Note: See TracTickets for help on using tickets.