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

Build warning C4127 on Windows using MSVC 19.26.288806 in C++20 mode #1825

Closed
mbeckh opened this issue Aug 16, 2020 · 2 comments
Closed

Build warning C4127 on Windows using MSVC 19.26.288806 in C++20 mode #1825

mbeckh opened this issue Aug 16, 2020 · 2 comments

Comments

@mbeckh
Copy link

mbeckh commented Aug 16, 2020

The code

std::string x = fmt::format("{}", std::chrono::system_clock::now().time_since_epoch())

produces warning C4127 ("conditional expression is constant, consider using 'if constexpr' statement instead") for the following lines

fmt\chrono.h: line 75
fmt\chrono.h: line 83
fmt\chrono.h: line 94
fmt\chrono.h: line 96
fmt\chrono.h: line 197
fmt\chrono.h: line 213

Latest verification of warning with master at commit f9f02df.

@vitaut
Copy link
Contributor

vitaut commented Aug 16, 2020

https://github.com/fmtlib/fmt/blob/master/include/fmt/chrono.h#L75 and similar should be wrapped in a call to const_check. A PR is welcome.

vitaut added a commit that referenced this issue Aug 26, 2020
vitaut added a commit that referenced this issue Aug 26, 2020
@vitaut
Copy link
Contributor

vitaut commented Aug 26, 2020

Suppressed the warnings in #1825.

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