ericniebler / range-v3

Range library for C++14/17/20, basis for C++20's std::ranges
Other
4.14k stars 439 forks source link

Compile errors with AppleClang 12.0 #1604

Open fcooper8472 opened 3 years ago

fcooper8472 commented 3 years ago

I'm trying to compile a library using range-v3, on GitHub actions. CMake configuration has shows the following compiler:

-- Using CMake version 3.19.3
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode_12.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped

Building fails with the following errors:

In file included from /Users/runner/work/DataModule/DataModule/vcpkg/installed/x64-osx/include/concepts/compare.hpp:24:
/Users/runner/work/DataModule/DataModule/vcpkg/installed/x64-osx/include/range/v3/compare.hpp:37:12: error: class template partial specialization does not specialize any template argument; to define the primary template, remove the template argument list
    struct common_comparison_category<Ts...> : std::common_type<Ts...>
           ^
/Users/runner/work/DataModule/DataModule/vcpkg/installed/x64-osx/include/range/v3/compare.hpp:33:5: error: requires clause differs in template redeclaration
    template<typename... Ts>
    ^
/Users/runner/work/DataModule/DataModule/vcpkg/installed/x64-osx/include/range/v3/compare.hpp:27:4: note: previous template declaration is here
   template<typename... Ts>
   ^
In file included from /Users/runner/work/DataModule/DataModule/src/Utils.cpp:10:
In file included from /Users/runner/work/DataModule/DataModule/vcpkg/installed/x64-osx/include/range/v3/range/conversion.hpp:21:
In file included from /Users/runner/work/DataModule/DataModule/vcpkg/installed/x64-osx/include/range/v3/range_fwd.hpp:23:
/Users/runner/work/DataModule/DataModule/vcpkg/installed/x64-osx/include/concepts/compare.hpp:44:13: error: expected expression
            requires(detail::as_cref_t<T>& a, detail::as_cref_t<T>& b) {
            ^
/Users/runner/work/DataModule/DataModule/vcpkg/installed/x64-osx/include/concepts/compare.hpp:55:13: error: expected expression
            requires(detail::as_cref_t<T>& t, detail::as_cref_t<U>& u) {
            ^
/Users/runner/work/DataModule/DataModule/vcpkg/installed/x64-osx/include/concepts/compare.hpp:50:13: error: use of undeclared identifier 'three_way_comparable'
            three_way_comparable<T, Cat> &&
            ^
/Users/runner/work/DataModule/DataModule/vcpkg/installed/x64-osx/include/concepts/compare.hpp:51:13: error: use of undeclared identifier 'three_way_comparable'
            three_way_comparable<U, Cat> &&
            ^
/Users/runner/work/DataModule/DataModule/vcpkg/installed/x64-osx/include/concepts/compare.hpp:53:13: error: use of undeclared identifier 'three_way_comparable'
            three_way_comparable<common_reference_t<detail::as_cref_t<T>&, detail::as_cref_t<U>&>> &&
            ^
In file included from /Users/runner/work/DataModule/DataModule/src/Utils.cpp:10:
In file included from /Users/runner/work/DataModule/DataModule/vcpkg/installed/x64-osx/include/range/v3/range/conversion.hpp:23:
In file included from /Users/runner/work/DataModule/DataModule/vcpkg/installed/x64-osx/include/range/v3/action/concepts.hpp:23:
In file included from /Users/runner/work/DataModule/DataModule/vcpkg/installed/x64-osx/include/range/v3/range/concepts.hpp:36:
/Users/runner/work/DataModule/DataModule/vcpkg/installed/x64-osx/include/range/v3/functional/comparisons.hpp:108:22: error: use of undeclared identifier 'three_way_comparable_with'
            requires three_way_comparable_with<T, U>)
                     ^
/Users/runner/work/DataModule/DataModule/vcpkg/installed/x64-osx/include/range/v3/detail/prologue.hpp:35:26: note: expanded from macro 'template'
    template<__VA_ARGS__ CPP_TEMPLATE_AUX_                                      \
                         ^
/Users/runner/work/DataModule/DataModule/vcpkg/installed/x64-osx/include/concepts/concepts.hpp:269:27: note: expanded from macro 'CPP_TEMPLATE_AUX_'
#define CPP_TEMPLATE_AUX_ CPP_TEMPLATE_SFINAE_AUX_
                          ^
8 errors generated.

It compiles fine on Ubuntu using a range of GCC versions, and on Windows. Any ideas?

fcooper8472 commented 3 years ago

These compile errors occur when compiling in C++20 mode

set(CMAKE_CXX_STANDARD 20)

but not in C++17 mode

set(CMAKE_CXX_STANDARD 17)

My guess is there's something range-v3 assumes to be available in C++20 that is not yet available in the versions of AppleClang I've tried using.

Slightly annoying, as it would be nice to be able to use range-v3 along with features that ARE already available.

szaszm commented 3 years ago

This should be already fixed by c6d7c748, but it's not released yet. I ran into the same issue, testing the build with the fix commit at the moment.