skip to Main Content

C++20 not available – Ubuntu

I'm currently trying to build code using gcc / g++ like this: g++-10 -std=c++2a -Wall -Wextra -c -o hw01.o hw01.cpp (Also the same outcome with gcc-10, gcc, g++) And I have a static check in my Code: static_assert(__cplusplus >= 202002L);…

VIEW QUESTION

Ubuntu – Undefined behavior (according to clang -fsanitize=integer) on libstdc++ std::random due to negative index on Mersenne Twister engine

I'm using clang++ 10 on Ubuntu 20.04 LTS, with -fsanitize-undefined-trap-on-error -fsanitize=address,undefined,nullability,implicit-integer-truncation,implicit-integer-arithmetic-value-change,implicit-conversion,integer My code is generating random bytes with std::random_device rd; std::mt19937 gen(rd()); std::uniform_int_distribution<uint8_t> dd(0, 255); ... ch = uint8_t(dd(gen)); This last line causes the sanitizer to report undefined behavior is…

VIEW QUESTION
Back To Top
Search