Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sandbox: Do not use int8_t in std::uniform_int_distribution #764

Merged
merged 1 commit into from
Apr 24, 2023

Conversation

kraj
Copy link
Contributor

@kraj kraj commented Sep 1, 2022

Newer versions of libc++ has dropped supporting this usecase since its
an UB see.

https://reviews.llvm.org/D114920?id=400571

Fixes

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");
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/libcereal/1.3.2+gitAUTOINC+ebef1e9298-r0/git/sandbox/performance.cpp:261:9: note: in instantiation of template class 'std::uniform_int_distribution' requested here
c = std::uniform_int_distribution(' ', '')(gen);
^
/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/libcereal/1.3.2+gitAUTOINC+ebef1e9298-r0/git/sandbox/performance.cpp:261:9: error: type 'std::uniform_int_distribution' does not provide a call operator
c = std::uniform_int_distribution(' ', '
')(gen);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.

Signed-off-by: Khem Raj raj.khem@gmail.com

Newer versions of libc++ has dropped supporting this usecase since its
an UB see.

https://reviews.llvm.org/D114920?id=400571

Fixes

uniform_int_distribution.h:162:5: error: static assertion failed due to requirement '__libcpp_random_is_valid_inttype<char>::value': IntType must be a supported integer type
    static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be a supported integer type");
    ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/libcereal/1.3.2+gitAUTOINC+ebef1e9298-r0/git/sandbox/performance.cpp:261:9: note: in instantiation of template class 'std::uniform_int_distribution<char>' requested here
    c = std::uniform_int_distribution<char>(' ', '~')(gen);
        ^
/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/libcereal/1.3.2+gitAUTOINC+ebef1e9298-r0/git/sandbox/performance.cpp:261:9: error: type 'std::uniform_int_distribution<char>' does not provide a call operator
    c = std::uniform_int_distribution<char>(' ', '~')(gen);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
@AzothAmmo AzothAmmo added the bug label Apr 24, 2023
@AzothAmmo AzothAmmo added this to the v1.3.3 milestone Apr 24, 2023
@AzothAmmo AzothAmmo merged commit f3e31f3 into USCiLab:master Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants