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

FMT_COMPILE(s) does not work with chrono example #2280

Closed
toughengineer opened this issue May 12, 2021 · 2 comments · Fixed by #2304
Closed

FMT_COMPILE(s) does not work with chrono example #2280

toughengineer opened this issue May 12, 2021 · 2 comments · Fixed by #2304

Comments

@toughengineer
Copy link
Contributor

toughengineer commented May 12, 2021

chrono example from here
https://fmt.dev/latest/syntax.html
works on its own

(click to expand the initial example)
#include <fmt/chrono.h>

auto t = tm();
t.tm_year = 2010 - 1900;
t.tm_mon = 6;
t.tm_mday = 4;
t.tm_hour = 12;
t.tm_min = 15;
t.tm_sec = 58;
fmt::print("{:%Y-%m-%d %H:%M:%S}", t);

but fails to compile with latest master with all latest major compilers when used with FMT_COMPILE(s) as explained here
https://fmt.dev/latest/api.html#compile-api
like this:

fmt::print(FMT_COMPILE("{:%Y-%m-%dT%H:%M:%S}"), t);

E.g. see
https://godbolt.org/z/TzzG3cvGe

@vitaut
Copy link
Contributor

vitaut commented May 12, 2021

Same as #1938.

@alexezeder
Copy link
Contributor

But it works with this code: https://godbolt.org/z/3KG8P4zzz
So the code from the first message doesn't work because fmt::print doesn't have FMT_COMPILE-friendly overload.

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.

3 participants