range-v3 icon indicating copy to clipboard operation
range-v3 copied to clipboard

Cannot compile 0.11.0 with clang 13.0 + libc++

Open yaoxinliu opened this issue 2 years ago • 3 comments

clang 12.0.1 + libc++ is ok. clang 13.0 + libstdc++ is ok. clang 13.0 + libc++ is failed to compile with the simplest demo.

#include <iostream>
#include <string>
#include <vector>

#include <range/v3/view/filter.hpp>
#include <range/v3/view/transform.hpp>

using namespace ranges;

using std::cout;

int main()
{
    std::vector<int> const vi{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};

    auto rng = vi | views::filter([](int i) { return i % 2 == 0; }) |
               views::transform([](int i) { return std::to_string(i); });
    cout << rng << '\n';
}

clang++ -std=c++2b -stdlib=libc++ main.cpp

In file included from main.cpp:5:
In file included from /usr/local/include/range/v3/view/filter.hpp:23:
In file included from /usr/local/include/range/v3/view/remove_if.hpp:27:
In file included from /usr/local/include/range/v3/range/access.hpp:34:
In file included from /usr/local/include/range/v3/iterator/concepts.hpp:30:
In file included from /usr/local/include/range/v3/iterator/access.hpp:22:
/usr/local/include/std/detail/associated_types.hpp:270:60: error: too many template arguments for class template '__iterator_traits'
            &is_std_iterator_traits_specialized_impl_(std::__iterator_traits<I, B> *))[2];
                                                           ^                    ~~
/usr/local/bin/../include/c++/v1/__iterator/iterator_traits.h:326:8: note: template is declared here
struct __iterator_traits {};
       ^
1 error generated.

See also: https://godbolt.org/z/qbjnETEWY

yaoxinliu avatar Oct 13 '21 14:10 yaoxinliu

This a dupe of https://github.com/ericniebler/range-v3/issues/1633 fixed in https://github.com/ericniebler/range-v3/pull/1635

andrei-datcu avatar Oct 27 '21 14:10 andrei-datcu

I see, so it's fixed in master, just not released. Thanks for finding that out. So the only problem is, that the latest release of range-v3 now doesn't work with the latest release of Clang.

rbrich avatar Oct 27 '21 17:10 rbrich

Please note that same fix as in #1635 applies to include/std/iterator when compiled with -DRANGES_DEEP_STL_INTEGRATION

piotrrak avatar Dec 02 '21 16:12 piotrrak