[libcxx-commits] [PATCH] D114129: [libc++] Fix `uniform_int_distribution` for 128-bit result type
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Dec 2 06:20:47 PST 2021
ldionne added a comment.
In D114129#3165399 <https://reviews.llvm.org/D114129#3165399>, @leonardchan wrote:
> Hi. I think the build issue we're seeing (https://ci.chromium.org/ui/p/fuchsia/builders/ci/clang_toolchain.ci.core.x64-debug-subbuild/b8829019800818975281/overview) is caused by this patch:
>
> ../../../../llvm-monorepo/llvm-build-1-master-fuchsia-toolchain/install/bin/../include/c++/v1/bit:142:5: error: static_assert failed due to requirement '__libcpp_is_unsigned_integer<i
> nt>::value' "__countl_zero requires an unsigned integer type"
> static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__countl_zero requires an unsigned integer type");
> ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../../../../llvm-monorepo/llvm-build-1-master-fuchsia-toolchain/install/bin/../include/c++/v1/__random/uniform_int_distribution.h:242:24: note: in instantiation of function template s
> pecialization 'std::__countl_zero<int>' requested here
> size_t __w = _Dt - __countl_zero(_Rp) - 1;
> ^
> ../../../../llvm-monorepo/llvm-build-1-master-fuchsia-toolchain/install/bin/../include/c++/v1/__random/uniform_int_distribution.h:206:17: note: in instantiation of function template s
> pecialization 'std::uniform_int_distribution<bool>::operator()<std::linear_congruential_engine<unsigned int, 48271, 0, 2147483647>>' requested here
> {return (*this)(__g, __p_);}
> ^
> ../../src/tests/fidl/compatibility/compatibility_test.cc:592:43: note: in instantiation of function template specialization 'std::uniform_int_distribution<bool>::operator()<std::linea
> r_congruential_engine<unsigned int, 48271, 0, 2147483647>>' requested here
> s->primitive_types.b = bool_distribution(rand_engine);
> ^
>
> Is there something wrong on our end that's causing this to happen, or is this from something incorrect with the patch?
@leonardchan
It's technically not allowed to instantiate the distributions with `bool`. In that other patch, I am pushing so that we make it ill-formed and provide a diagnostic -- are you able to fix the code on your side?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114129/new/
https://reviews.llvm.org/D114129
More information about the libcxx-commits
mailing list