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

Clang warnings Wsign-conversion #1228

Closed
DaanDeMeyer opened this issue Jul 14, 2019 · 6 comments
Closed

Clang warnings Wsign-conversion #1228

DaanDeMeyer opened this issue Jul 14, 2019 · 6 comments

Comments

@DaanDeMeyer
Copy link
Contributor

_deps/fmt-src/include/fmt/format.h:1566:45: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
    size_t size() const { return num_digits + 2; }

_deps/fmt-src/include/fmt/format.h:1588:28: warning: implicit conversion changes signedness: 'const int' to 'unsigned int' [-Wsign-conversion]
    unsigned width = specs.width;  // User-perceived width (in code points).

_deps/fmt-src/include/fmt/format.h:1317:22: warning: implicit conversion changes signedness: 'int' to 'std::size_t' (aka 'unsigned long') [-Wsign-conversion]
        size = specs.width;

_deps/fmt-src/include/fmt/format.h:1316:25: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion]
        padding = specs.width - size;

Started appearing after include fmt/ostream.h

@DaanDeMeyer DaanDeMeyer changed the title GCC Warning Wsign-conversion Clang warnings Wsign-conversion Jul 14, 2019
@vitaut
Copy link
Contributor

vitaut commented Jul 15, 2019

Thanks for reporting. Which compiler version are you using?

@DaanDeMeyer
Copy link
Contributor Author

Clang 8.0.0 (Arch Linux)

@vitaut
Copy link
Contributor

vitaut commented Jul 15, 2019

Also could you provide an example that reproduces the warning?

@DaanDeMeyer
Copy link
Contributor Author

_deps/fmt-src/include/fmt/format.h:1689:46: warning: implicit conversion changes signedness: 'int' to 'std::size_t' (aka 'unsigned long') [-Wsign-conversion]
    if (!specs) return pw(reserve(num_digits + 2));

I forgot to include this one as well.

@DaanDeMeyer
Copy link
Contributor Author

https://github.com/DaanDeMeyer/fmt-warning-reproduce

This repo should reproduce the warnings (GCC 9.1.0 triggers them as well).

@vitaut
Copy link
Contributor

vitaut commented Jul 18, 2019

Should be fixed now.

@vitaut vitaut closed this as completed Jul 18, 2019
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

No branches or pull requests

2 participants