test/http_client.cpp fails to build (catch2)
Closed this issue · 2 comments
dpellegr commented
I am getting a compilation error related to the use of catch2 v2.12.2 in test/http_client.cpp (GCC 10.1)
In file included from /var/cache/makepkg/nngpp-git/src/nngpp/test/http_client.cpp:1:
/usr/include/catch2/catch.hpp: In instantiation of ‘std::string Catch::rangeToString(const Range&) [with Range = nng::aio; std::string = std::__cxx11::basic_string<char>]’:
/usr/include/catch2/catch.hpp:2046:33: required from ‘static std::string Catch::StringMaker<R, typename std::enable_if<(Catch::is_range<T>::value && (! Catch::Detail::IsStreamInsertable<T>::value))>::type>::convert(const R&) [with R = nng::aio; std::string = std::__cxx11::basic_string<char>]’
/usr/include/catch2/catch.hpp:1649:121: required from ‘std::string Catch::Detail::stringify(const T&) [with T = nng::aio; std::string = std::__cxx11::basic_string<char>]’
/usr/include/catch2/catch.hpp:2308:43: required from ‘void Catch::UnaryExpr<LhsT>::streamReconstructedExpression(std::ostream&) const [with LhsT = const nng::aio&; std::ostream = std::basic_ostream<char>]’
/usr/include/catch2/catch.hpp:2307:14: required from here
/usr/include/catch2/catch.hpp:2023:67: error: no matching function for call to ‘end(const nng::aio&)’
2023 | return ::Catch::Detail::rangeToString( begin( range ), end( range ) );
| ~~~^~~~~~~~~
In file included from /usr/include/c++/10.1.0/string:54,
from /usr/include/catch2/catch.hpp:481,
from /var/cache/makepkg/nngpp-git/src/nngpp/test/http_client.cpp:1:
/usr/include/c++/10.1.0/bits/range_access.h:110:37: note: candidate: ‘template<class _Tp> const _Tp* std::end(const std::valarray<_Tp>&)’
110 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&);
| ^~~
/usr/include/c++/10.1.0/bits/range_access.h:110:37: note: template argument deduction/substitution failed:
In file included from /var/cache/makepkg/nngpp-git/src/nngpp/test/http_client.cpp:1:
/usr/include/catch2/catch.hpp:2023:67: note: ‘const nng::aio’ is not derived from ‘const std::valarray<_Tp>’
2023 | return ::Catch::Detail::rangeToString( begin( range ), end( range ) );
| ~~~^~~~~~~~~
In file included from /usr/include/c++/10.1.0/string:54,
from /usr/include/catch2/catch.hpp:481,
from /var/cache/makepkg/nngpp-git/src/nngpp/test/http_client.cpp:1:
/usr/include/c++/10.1.0/bits/range_access.h:109:31: note: candidate: ‘template<class _Tp> _Tp* std::end(std::valarray<_Tp>&)’
109 | template<typename _Tp> _Tp* end(valarray<_Tp>&);
| ^~~
/usr/include/c++/10.1.0/bits/range_access.h:109:31: note: template argument deduction/substitution failed:
In file included from /var/cache/makepkg/nngpp-git/src/nngpp/test/http_client.cpp:1:
/usr/include/catch2/catch.hpp:2023:67: note: types ‘std::valarray<_Tp>’ and ‘const nng::aio’ have incompatible cv-qualifiers
2023 | return ::Catch::Detail::rangeToString( begin( range ), end( range ) );
| ~~~^~~~~~~~~
In file included from /usr/include/c++/10.1.0/string:54,
from /usr/include/catch2/catch.hpp:481,
from /var/cache/makepkg/nngpp-git/src/nngpp/test/http_client.cpp:1:
/usr/include/c++/10.1.0/bits/range_access.h:100:5: note: candidate: ‘template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])’
100 | end(_Tp (&__arr)[_Nm])
| ^~~
/usr/include/c++/10.1.0/bits/range_access.h:100:5: note: template argument deduction/substitution failed:
In file included from /var/cache/makepkg/nngpp-git/src/nngpp/test/http_client.cpp:1:
/usr/include/catch2/catch.hpp:2023:67: note: mismatched types ‘_Tp [_Nm]’ and ‘const nng::aio’
2023 | return ::Catch::Detail::rangeToString( begin( range ), end( range ) );
| ~~~^~~~~~~~~
In file included from /usr/include/c++/10.1.0/string:54,
from /usr/include/catch2/catch.hpp:481,
from /var/cache/makepkg/nngpp-git/src/nngpp/test/http_client.cpp:1:
/usr/include/c++/10.1.0/bits/range_access.h:81:5: note: candidate: ‘template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)’
81 | end(const _Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/10.1.0/bits/range_access.h:81:5: note: template argument deduction/substitution failed:
/usr/include/c++/10.1.0/bits/range_access.h: In substitution of ‘template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&) [with _Container = nng::aio]’:
/usr/include/catch2/catch.hpp:2023:67: required from ‘std::string Catch::rangeToString(const Range&) [with Range = nng::aio; std::string = std::__cxx11::basic_string<char>]’
/usr/include/catch2/catch.hpp:2046:33: required from ‘static std::string Catch::StringMaker<R, typename std::enable_if<(Catch::is_range<T>::value && (! Catch::Detail::IsStreamInsertable<T>::value))>::type>::convert(const R&) [with R = nng::aio; std::string = std::__cxx11::basic_string<char>]’
/usr/include/catch2/catch.hpp:1649:121: required from ‘std::string Catch::Detail::stringify(const T&) [with T = nng::aio; std::string = std::__cxx11::basic_string<char>]’
/usr/include/catch2/catch.hpp:2308:43: required from ‘void Catch::UnaryExpr<LhsT>::streamReconstructedExpression(std::ostream&) const [with LhsT = const nng::aio&; std::ostream = std::basic_ostream<char>]’
/usr/include/catch2/catch.hpp:2307:14: required from here
/usr/include/c++/10.1.0/bits/range_access.h:81:54: error: ‘const struct nng::aio’ has no member named ‘end’
81 | end(const _Container& __cont) -> decltype(__cont.end())
| ~~~~~~~^~~
/usr/include/catch2/catch.hpp: In instantiation of ‘std::string Catch::rangeToString(const Range&) [with Range = nng::aio; std::string = std::__cxx11::basic_string<char>]’:
/usr/include/catch2/catch.hpp:2046:33: required from ‘static std::string Catch::StringMaker<R, typename std::enable_if<(Catch::is_range<T>::value && (! Catch::Detail::IsStreamInsertable<T>::value))>::type>::convert(const R&) [with R = nng::aio; std::string = std::__cxx11::basic_string<char>]’
/usr/include/catch2/catch.hpp:1649:121: required from ‘std::string Catch::Detail::stringify(const T&) [with T = nng::aio; std::string = std::__cxx11::basic_string<char>]’
/usr/include/catch2/catch.hpp:2308:43: required from ‘void Catch::UnaryExpr<LhsT>::streamReconstructedExpression(std::ostream&) const [with LhsT = const nng::aio&; std::ostream = std::basic_ostream<char>]’
/usr/include/catch2/catch.hpp:2307:14: required from here
/usr/include/c++/10.1.0/bits/range_access.h:71:5: note: candidate: ‘template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)’
71 | end(_Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/10.1.0/bits/range_access.h:71:5: note: template argument deduction/substitution failed:
/usr/include/c++/10.1.0/bits/range_access.h: In substitution of ‘template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&) [with _Container = const nng::aio]’:
/usr/include/catch2/catch.hpp:2023:67: required from ‘std::string Catch::rangeToString(const Range&) [with Range = nng::aio; std::string = std::__cxx11::basic_string<char>]’
/usr/include/catch2/catch.hpp:2046:33: required from ‘static std::string Catch::StringMaker<R, typename std::enable_if<(Catch::is_range<T>::value && (! Catch::Detail::IsStreamInsertable<T>::value))>::type>::convert(const R&) [with R = nng::aio; std::string = std::__cxx11::basic_string<char>]’
/usr/include/catch2/catch.hpp:1649:121: required from ‘std::string Catch::Detail::stringify(const T&) [with T = nng::aio; std::string = std::__cxx11::basic_string<char>]’
/usr/include/catch2/catch.hpp:2308:43: required from ‘void Catch::UnaryExpr<LhsT>::streamReconstructedExpression(std::ostream&) const [with LhsT = const nng::aio&; std::ostream = std::basic_ostream<char>]’
/usr/include/catch2/catch.hpp:2307:14: required from here
/usr/include/c++/10.1.0/bits/range_access.h:71:48: error: ‘const struct nng::aio’ has no member named ‘end’
71 | end(_Container& __cont) -> decltype(__cont.end())
| ~~~~~~~^~~
In file included from /usr/include/c++/10.1.0/bits/range_access.h:36,
from /usr/include/c++/10.1.0/string:54,
from /usr/include/catch2/catch.hpp:481,
from /var/cache/makepkg/nngpp-git/src/nngpp/test/http_client.cpp:1:
/usr/include/catch2/catch.hpp: In instantiation of ‘std::string Catch::rangeToString(const Range&) [with Range = nng::aio; std::string = std::__cxx11::basic_string<char>]’:
/usr/include/catch2/catch.hpp:2046:33: required from ‘static std::string Catch::StringMaker<R, typename std::enable_if<(Catch::is_range<T>::value && (! Catch::Detail::IsStreamInsertable<T>::value))>::type>::convert(const R&) [with R = nng::aio; std::string = std::__cxx11::basic_string<char>]’
/usr/include/catch2/catch.hpp:1649:121: required from ‘std::string Catch::Detail::stringify(const T&) [with T = nng::aio; std::string = std::__cxx11::basic_string<char>]’
/usr/include/catch2/catch.hpp:2308:43: required from ‘void Catch::UnaryExpr<LhsT>::streamReconstructedExpression(std::ostream&) const [with LhsT = const nng::aio&; std::ostream = std::basic_ostream<char>]’
/usr/include/catch2/catch.hpp:2307:14: required from here
/usr/include/c++/10.1.0/initializer_list:101:5: note: candidate: ‘template<class _Tp> constexpr const _Tp* std::end(std::initializer_list<_Tp>)’
101 | end(initializer_list<_Tp> __ils) noexcept
| ^~~
/usr/include/c++/10.1.0/initializer_list:101:5: note: template argument deduction/substitution failed:
In file included from /var/cache/makepkg/nngpp-git/src/nngpp/test/http_client.cpp:1:
/usr/include/catch2/catch.hpp:2023:67: note: ‘nng::aio’ is not derived from ‘std::initializer_list<_Tp>’
2023 | return ::Catch::Detail::rangeToString( begin( range ), end( range ) );
| ~~~^~~~~~~~~
cwzx commented
It's working with Catch2 v2.12.1 and GCC 10.1.
But I get the same error as you when using Catch2 v2.12.2.
Looks like a Catch issue.
It's being triggered because nng::aio
has a begin()
member function, and Catch is now incorrectly assuming it's a range.
catchorg/Catch2@b1b5cb8#diff-517f9182596f90e5f6dcf26ec964e99cR2006
cwzx commented
Fix for this is now on master.