martinmoene / span-lite

span lite - A C++20-like span for C++98, C++11 and later in a single-file header-only library
Boost Software License 1.0
499 stars 43 forks source link

Tests don't build against libc++ #44

Closed wak-google closed 4 years ago

wak-google commented 5 years ago

Looks like libc++ doesn't like std::equal between volatile and non-volatile members in the test cases

In file included from /build/span-lite/test/span.t.cpp:11:
In file included from /build/span-lite/test/span-main.t.hpp:19:
In file included from /build/span-lite/include/nonstd/span.hpp:194:
/usr/include/c++/v1/algorithm:1325:14: error: no matching function for call to object of type 'std::__1::__equal_to<int, int>'
        if (!__pred(*__first1, *__first2))
             ^~~~~~
/usr/include/c++/v1/algorithm:1337:19: note: in instantiation of function template specialization 'std::__1::equal<const volatile int *, int *, std::__1::__equal_to<int, int> >' requested here
    return _VSTD::equal(__first1, __last1, __first2, __equal_to<__v1, __v2>());
                  ^
/build/span-lite/test/span.t.cpp:441:18: note: in instantiation of function template specialization 'std::__1::equal<const volatile int *, int *>' requested here
    EXPECT( std::equal( x.begin(), x.end(), arr ) );
                 ^
/build/span-lite/test/lest_cpp03.hpp:257:28: note: expanded from macro 'EXPECT'
# define EXPECT            lest_EXPECT
                           ^
/usr/include/c++/v1/algorithm:682:10: note: candidate function not viable: 1st argument ('const volatile int') would lose volatile qualifier
    bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;}
         ^
1 error generated.
make[2]: *** [test/CMakeFiles/span-lite-cpp98.t.dir/build.make:76: test/CMakeFiles/span-lite-cpp98.t.dir/span.t.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:134: test/CMakeFiles/span-lite-cpp98.t.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
/build/span-lite/test/span.t.cpp:89:99: warning: 'operator()' is deprecated: replace operator() with operator[] [-Wdeprecated-declarations]
        static void blow_iv(index_type i) { int arr[] = { 1, 2, 3, }; span<int> v( arr ); (void) v(i); }
                                                                                                  ^
/build/span-lite/include/nonstd/span.hpp:1067:5: note: 'operator()' has been explicitly marked deprecated here
    span_deprecated("replace operator() with operator[]")
    ^
/build/span-lite/include/nonstd/span.hpp:388:33: note: expanded from macro 'span_deprecated'
# define span_deprecated(msg) [[deprecated(msg)]]
                                ^
/build/span-lite/test/span.t.cpp:596:18: warning: 'operator()' is deprecated: replace operator() with operator[] [-Wdeprecated-declarations]
        EXPECT( v(i) == arr[i] );
                 ^
/build/span-lite/test/lest_cpp03.hpp:257:28: note: expanded from macro 'EXPECT'
# define EXPECT            lest_EXPECT
                           ^
/build/span-lite/include/nonstd/span.hpp:1067:5: note: 'operator()' has been explicitly marked deprecated here
    span_deprecated("replace operator() with operator[]")
    ^
/build/span-lite/include/nonstd/span.hpp:388:33: note: expanded from macro 'span_deprecated'
# define span_deprecated(msg) [[deprecated(msg)]]
                                ^
/build/span-lite/test/span.t.cpp:597:18: warning: 'operator()' is deprecated: replace operator() with operator[] [-Wdeprecated-declarations]
        EXPECT( w(i) == arr[i] );
                 ^
/build/span-lite/test/lest_cpp03.hpp:257:28: note: expanded from macro 'EXPECT'
# define EXPECT            lest_EXPECT
                           ^
/build/span-lite/include/nonstd/span.hpp:1067:5: note: 'operator()' has been explicitly marked deprecated here
    span_deprecated("replace operator() with operator[]")
    ^
/build/span-lite/include/nonstd/span.hpp:388:33: note: expanded from macro 'span_deprecated'
# define span_deprecated(msg) [[deprecated(msg)]]
                                ^
/build/span-lite/test/span.t.cpp:681:6: warning: 'operator()' is deprecated: replace operator() with operator[] [-Wdeprecated-declarations]
    v(1) = 22;
     ^
/build/span-lite/include/nonstd/span.hpp:1067:5: note: 'operator()' has been explicitly marked deprecated here
    span_deprecated("replace operator() with operator[]")
    ^
/build/span-lite/include/nonstd/span.hpp:388:33: note: expanded from macro 'span_deprecated'
# define span_deprecated(msg) [[deprecated(msg)]]
                                ^
/build/span-lite/test/span.t.cpp:682:6: warning: 'operator()' is deprecated: replace operator() with operator[] [-Wdeprecated-declarations]
    w(2) = 33;
     ^
/build/span-lite/include/nonstd/span.hpp:1067:5: note: 'operator()' has been explicitly marked deprecated here
    span_deprecated("replace operator() with operator[]")
    ^
/build/span-lite/include/nonstd/span.hpp:388:33: note: expanded from macro 'span_deprecated'
# define span_deprecated(msg) [[deprecated(msg)]]
                                ^
In file included from /build/span-lite/test/span.t.cpp:11:
In file included from /build/span-lite/test/span-main.t.hpp:19:
In file included from /build/span-lite/include/nonstd/span.hpp:194:
/usr/include/c++/v1/algorithm:1325:14: error: no matching function for call to object of type 'std::__1::__equal_to<int, int>'
        if (!__pred(*__first1, *__first2))
             ^~~~~~
/usr/include/c++/v1/algorithm:1337:19: note: in instantiation of function template specialization 'std::__1::equal<const volatile int *, int *, std::__1::__equal_to<int, int> >' requested here
    return _VSTD::equal(__first1, __last1, __first2, __equal_to<__v1, __v2>());
                  ^
/build/span-lite/test/span.t.cpp:441:18: note: in instantiation of function template specialization 'std::__1::equal<const volatile int *, int *>' requested here
    EXPECT( std::equal( x.begin(), x.end(), arr ) );
                 ^
/build/span-lite/test/lest_cpp03.hpp:257:28: note: expanded from macro 'EXPECT'
# define EXPECT            lest_EXPECT
                           ^
/usr/include/c++/v1/algorithm:682:10: note: candidate function not viable: 1st argument ('const volatile int') would lose volatile qualifier
    bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;}
         ^
1 error generated.
make[2]: *** [test/CMakeFiles/span-lite-cpp11.t.dir/build.make:76: test/CMakeFiles/span-lite-cpp11.t.dir/span.t.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:208: test/CMakeFiles/span-lite-cpp11.t.dir/all] Error 2
In file included from /build/span-lite/test/span.t.cpp:11:
In file included from /build/span-lite/test/span-main.t.hpp:19:
In file included from /build/span-lite/include/nonstd/span.hpp:194:
/usr/include/c++/v1/algorithm:1325:14: error: no matching function for call to object of type 'std::__1::__equal_to<int, int>'
        if (!__pred(*__first1, *__first2))
             ^~~~~~
/usr/include/c++/v1/algorithm:1337:19: note: in instantiation of function template specialization 'std::__1::equal<const volatile int *, int *, std::__1::__equal_to<int, int> >' requested here
    return _VSTD::equal(__first1, __last1, __first2, __equal_to<__v1, __v2>());
                  ^
/build/span-lite/test/span.t.cpp:441:18: note: in instantiation of function template specialization 'std::__1::equal<const volatile int *, int *>' requested here
    EXPECT( std::equal( x.begin(), x.end(), arr ) );
                 ^
/build/span-lite/test/lest_cpp03.hpp:257:28: note: expanded from macro 'EXPECT'
# define EXPECT            lest_EXPECT
                           ^
/usr/include/c++/v1/algorithm:682:10: note: candidate function not viable: 1st argument ('const volatile int') would lose volatile qualifier
    bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;}
         ^
1 error generated.
make[2]: *** [test/CMakeFiles/span-lite-cpp14.t.dir/build.make:76: test/CMakeFiles/span-lite-cpp14.t.dir/span.t.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:97: test/CMakeFiles/span-lite-cpp14.t.dir/all] Error 2
In file included from /build/span-lite/test/span.t.cpp:11:
In file included from /build/span-lite/test/span-main.t.hpp:19:
In file included from /build/span-lite/include/nonstd/span.hpp:194:
/usr/include/c++/v1/algorithm:1325:14: error: no matching function for call to object of type 'std::__1::__equal_to<int, int>'
        if (!__pred(*__first1, *__first2))
             ^~~~~~
/usr/include/c++/v1/algorithm:1337:19: note: in instantiation of function template specialization 'std::__1::equal<const volatile int *, int *, std::__1::__equal_to<int, int> >' requested here
    return _VSTD::equal(__first1, __last1, __first2, __equal_to<__v1, __v2>());
                  ^
/build/span-lite/test/span.t.cpp:441:18: note: in instantiation of function template specialization 'std::__1::equal<const volatile int *, int *>' requested here
    EXPECT( std::equal( x.begin(), x.end(), arr ) );
                 ^
/build/span-lite/test/lest_cpp03.hpp:257:28: note: expanded from macro 'EXPECT'
# define EXPECT            lest_EXPECT
                           ^
/usr/include/c++/v1/algorithm:682:10: note: candidate function not viable: 1st argument ('const volatile int') would lose volatile qualifier
    bool operator()(const _T1& __x, const _T1& __y) const {return __x == __y;}
         ^
5 warnings and 1 error generated.
make[2]: *** [test/CMakeFiles/span-lite-cpp17.t.dir/build.make:76: test/CMakeFiles/span-lite-cpp17.t.dir/span.t.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:171: test/CMakeFiles/span-lite-cpp17.t.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
martinmoene commented 4 years ago

Solved by #52 , thanks to @wak-google / @wkennington