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

formatted_size with format specifiers & FMT_COMPILE #3586

Closed
elbeno opened this issue Aug 13, 2023 · 1 comment
Closed

formatted_size with format specifiers & FMT_COMPILE #3586

elbeno opened this issue Aug 13, 2023 · 1 comment

Comments

@elbeno
Copy link
Contributor

elbeno commented Aug 13, 2023

formatted_size doesn't work with format specifications when using FMT_COMPILE.
(See also: issue #2141)

https://godbolt.org/z/G595Y78ns

CE currently uses 10.0.0 but the same issue is on master.
It does work with {:d} but not with {:x} or {:b}. {:s} doesn't work either (obviously for a stringish case). I haven't tried more complex format specs. {:x} and {:b} work if I mark https://github.com/fmtlib/fmt/blob/master/include/fmt/format.h#L1390 as constexpr, but I'm not sure that's a good fix (and doesn't address {:s}).

@vitaut
Copy link
Contributor

vitaut commented Aug 13, 2023

Making format_uint (conditionally) constexpr is the right solution and a PR is welcome. Similarly, for string formatting some additional constexprification is needed.

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