diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2023-01-18 21:11:30 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2023-01-19 19:13:02 +0000 |
commit | bbab107cd4100eb8986d72ed2b3b25d5646c509b (patch) | |
tree | 3d0095a909fdd31002428e3fce7f4a3dff9db5cc | |
parent | 555a0a9384de8ae8d9c9e25cd97bb0992035efc5 (diff) | |
download | ports-bbab107cd4100eb8986d72ed2b3b25d5646c509b.tar.gz ports-bbab107cd4100eb8986d72ed2b3b25d5646c509b.zip |
databases/soci: fix build with libc++ 15
During an exp-run for llvm 15 (see bug 265425), it turned out that
databases/soci failed to build with clang 15:
In file included from /wrkdirs/usr/ports/databases/soci/work/soci-4.0.3/tests/empty/test-empty.cpp:8:
In file included from /wrkdirs/usr/ports/databases/soci/work/soci-4.0.3/include/soci/soci.h:12:
In file included from /wrkdirs/usr/ports/databases/soci/work/soci-4.0.3/include/soci/soci-platform.h:18:
In file included from /usr/include/c++/v1/string:551:
In file included from /usr/include/c++/v1/string_view:222:
In file included from /usr/include/c++/v1/algorithm:1851:
In file included from /usr/include/c++/v1/__algorithm/ranges_sample.h:13:
In file included from /usr/include/c++/v1/__algorithm/sample.h:18:
/usr/include/c++/v1/__random/uniform_int_distribution.h:235:5: error: static assertion failed due to requirement '__libcpp_random_is_valid_urng<Catch::RandomNumberGenerator, void>::value':
static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/v1/__algorithm/shuffle.h:154:35: note: in instantiation of function template specialization 'std::uniform_int_distribution<long>::operator()<Catch::RandomNumberGenerator>' requested here
difference_type __i = __uid(__g, _Pp(0, __d));
^
/usr/include/c++/v1/__algorithm/shuffle.h:166:14: note: in instantiation of function template specialization 'std::__shuffle<std::_ClassicAlgPolicy, std::__wrap_iter<Catch::TestCase *>, std::__wrap_iter<Catch::TestCase *>, Catch::RandomNumberGenerator &>' requested here
(void)std::__shuffle<_ClassicAlgPolicy>(
^
/wrkdirs/usr/ports/databases/soci/work/soci-4.0.3/tests/catch.hpp:7186:18: note: in instantiation of function template specialization 'std::shuffle<std::__wrap_iter<Catch::TestCase *>, Catch::RandomNumberGenerator &>' requested here
std::shuffle( vector.begin(), vector.end(), rng );
^
/wrkdirs/usr/ports/databases/soci/work/soci-4.0.3/tests/catch.hpp:7204:44: note: in instantiation of function template specialization 'Catch::RandomNumberGenerator::shuffle<std::vector<Catch::TestCase>>' requested here
RandomNumberGenerator::shuffle( sorted );
^
This is because soci declares its RandomNumberGenerator class with a
result_type of std::ptrdiff_t, which is signed. However, the urng class
used for std::shuffle must have an unsigned integer type as its result
type. Use std::size_t instead.
PR: 269035
Approved by: nc (maintainer)
MFH: 2023Q1
-rw-r--r-- | databases/soci/files/patch-tests_catch.hpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/databases/soci/files/patch-tests_catch.hpp b/databases/soci/files/patch-tests_catch.hpp new file mode 100644 index 000000000000..97cd0e00127b --- /dev/null +++ b/databases/soci/files/patch-tests_catch.hpp @@ -0,0 +1,11 @@ +--- tests/catch.hpp.orig 2022-02-10 19:13:13 UTC ++++ tests/catch.hpp +@@ -7170,7 +7170,7 @@ namespace Catch { + namespace Catch { + + struct RandomNumberGenerator { +- typedef std::ptrdiff_t result_type; ++ typedef std::size_t result_type; + + result_type operator()( result_type n ) const { return std::rand() % n; } + |