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

fp(Double d) ctor adds static_assert that sizeof(double) == sizeof(uint64_t) #878

Closed
jgennis opened this issue Sep 23, 2018 · 1 comment
Closed

Comments

@jgennis
Copy link

jgennis commented Sep 23, 2018

It looks like fmt 5.1.0 introduced the fp class, which includes a ctor that calls bit_cast<uint64_t>(d). This ctor gets called from various places such that the type of d is double. In fmt 5.1.0 the first place that triggers the static_assert is in basic_writer::write_double. In fmt 5.2.1 the first place is in grisu2_format_positive.

I've been using fmt up to 5.0.0 targeting an architecture that doesn't support 64-bit floats, and so has both float and double defined to be 32-bit. Even though FMT_USE_GRISU is presumably 0 (I didn't define it, and it looks like it defaults to 0), the static_assert still triggers, preventing use of fmt 5.1.0 and 5.2.1 (I haven't tried 5.2.0, but I assume it has the same issue).

@vitaut
Copy link
Contributor

vitaut commented Sep 26, 2018

Fixed in d7f1761. Thanks for reporting!

@vitaut vitaut closed this as completed Sep 26, 2018
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