Repository: ericniebler/range-v3

Issue #1633: `std/detail/associated_types.hpp` will break with recent libc++
Created: 2021-06-07T18:03:13Z
Those lines won't work anymore with recent versions of libc++:

  
    
      range-v3/include/std/detail/associated_types.hpp
    
    
        Lines 267 to 272
      in
      e157199
    
  
  
    

        
          
           #elif defined(_LIBCPP_VERSION) 
        

        
          
                   template<typename I, bool B> 
        

        
          
                   char ( 
        

        
          
                       &is_std_iterator_traits_specialized_impl_(std::__iterator_traits<I, B> *))[2]; 
        

        
          
                   template<typename I> 
        

        
          
                   char is_std_iterator_traits_specialized_impl_(void *); 
        
    
  


I haven't done a formal bisect, but I think this is caused by
commit 9f01ac3b3257ab925a2b1229dba19e3eb86a706b
Author: zoecarver <z.zoelec2@gmail.com>
Date:   Tue Apr 20 08:50:11 2021 -0400

    [libcxx] makes `iterator_traits` C++20-aware

    * adds `iterator_traits` specialisation that supports all expected
      member aliases except for `pointer`
    * adds `iterator_traits` specialisations for iterators that meet the
      legacy iterator requirements but might lack multiple member aliases
    * makes pointer `iterator_traits` specialisation require objects

    Depends on D99854.

    Differential Revision: https://reviews.llvm.org/D99855

That change was made as part of our ongoing implementation of Ranges in libc++.
It looks like you are trying to detect whether a specialization of std::iterator_traits refers to the base template or to a full/partial specialization. If so, you could use the presence of the __primary_template member inside std::iterator_traits to detect that in newer versions. Even better would be to not rely on any implementation detail of libc++, however I expect you'll say that you can't live without it.
cc @zoecarver for awareness

Duplicate issue #1666: Cannot compile 0.11.0 with clang 13.0 + libc++
Created: 2021-10-13T14:04:32Z
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

Closing comment (2021-10-27T14:56:34Z): This a dupe of #1633 fixed in #1635