From 9f8385f9876a46d8566cd655062c8ba24efac2f5 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Mon, 12 Dec 2022 14:49:23 +0100 Subject: lang/gjs: fix build with libc++ 15 During an exp-run for llvm 15 (see bug 265425), it turned out that lang/gjs failed to build with clang and libc++ 15: In file included from ../test/gjs-tests.cpp:11: In file included from /usr/include/c++/v1/random:1689: In file included from /usr/include/c++/v1/__random/discrete_distribution.h:18: In file included from /usr/include/c++/v1/numeric:167: In file included from /usr/include/c++/v1/functional:515: In file included from /usr/include/c++/v1/__functional/boyer_moore_searcher.h:24: In file included from /usr/include/c++/v1/array:127: 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:162:5: error: static assertion failed due to requirement '__libcpp_random_is_valid_inttype::value': IntType must be a supported integer type static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be a supported integer type"); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../test/gjs-tests.cpp:71:16: note: in instantiation of template class 'std::uniform_int_distribution' requested here return std::uniform_int_distribution(lowest_value)(gen); ^ ../test/gjs-tests.cpp:942:30: note: in instantiation of function template specialization 'Gjs::Test::get_random_number' requested here char32_t random_char32 = get_random_number(); ^ This is because std::uniform_int_distribution is only defined for strict integer types, such as short, int, etc. Use std::uniform_int_distribution instead, and cast the result back to a char32_t. PR: 268329 Approved by: portmgr (tcberner) MFH: 2022Q4 --- lang/gjs/files/patch-test_gjs-tests.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 lang/gjs/files/patch-test_gjs-tests.cpp (limited to 'lang/gjs/files/patch-test_gjs-tests.cpp') diff --git a/lang/gjs/files/patch-test_gjs-tests.cpp b/lang/gjs/files/patch-test_gjs-tests.cpp new file mode 100644 index 000000000000..e5287370143d --- /dev/null +++ b/lang/gjs/files/patch-test_gjs-tests.cpp @@ -0,0 +1,11 @@ +--- test/gjs-tests.cpp.orig 2022-08-08 05:05:12 UTC ++++ test/gjs-tests.cpp +@@ -939,7 +939,7 @@ static void gjstest_test_args_set_get_unset() { + assert_equal(arg.v_uint64, random_uint64); + assert_equal(gjs_arg_get(&arg), random_uint64); + +- char32_t random_char32 = get_random_number(); ++ char32_t random_char32 = static_cast(get_random_number()); + gjs_arg_set(&arg, random_char32); + assert_equal(static_cast(arg.v_uint32), random_char32); + assert_equal(gjs_arg_get(&arg), random_char32); -- cgit v1.2.3