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

Sign conversion error in uuid_clock.hpp #162

Closed
k3DW opened this issue Aug 17, 2024 · 0 comments · Fixed by #163
Closed

Sign conversion error in uuid_clock.hpp #162

k3DW opened this issue Aug 17, 2024 · 0 comments · Fixed by #163

Comments

@k3DW
Copy link
Contributor

k3DW commented Aug 17, 2024

I got this error. It's causing Unordered tests to fail that weren't previously failing.

clang-linux.compile.c++ bin.v2/libs/unordered/test/visualization_tests.test/clang-linux-12/debug/x86_64/address-sanitizer-norecover/cxxstd-17-iso/stdlib-libc++/threading-multi/undefined-sanitizer-norecover/visibility-hidden/visualization_tests.o
In file included from libs/unordered/test/debuggability/visualization_tests.cpp:29:
In file included from ./boost/uuid/random_generator.hpp:10:
In file included from ./boost/uuid/basic_random_generator.hpp:10:
In file included from ./boost/uuid/uuid.hpp:9:
./boost/uuid/uuid_clock.hpp:66:34: error: implicit conversion changes signedness: 'std::chrono::duration<long, std::ratio<1, 10000000>>::rep' (aka 'long') to 'std::uint64_t' (aka 'unsigned long') [-Werror,-Wsign-conversion]
    return tp.time_since_epoch().count();
    ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
1 error generated.

I see a discrepancy in the uuid_clock class between int64_t and uint64_t. Not sure if one of these type should be changed to be the other one, or if static_cast is needed.

using rep = std::int64_t;
...
static time_point from_timestamp( std::uint64_t timestamp ) noexcept;
static std::uint64_t to_timestamp( time_point const& tp ) noexcept;

To reproduce it:

clang++ -Werror -Wsign-conversion path/to/boost/uuid/uuid_clock.hpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant