-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Fix std::byte formatting with compile-time API #2072
Fix std::byte formatting with compile-time API #2072
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR.
Using some tricks I was able to get a precise location of the line that fails Lines 1992 to 1993 in 0446614
This check fails with these values:
I don't have MSVC to check what is going on there - why a value of Lines 2125 to 2128 in 0446614
from here: Lines 3813 to 3818 in 0446614
while all other compilers invoke the following function from to_string above:Lines 2114 to 2123 in 0446614
I'm pretty confused about that so I think it's better if someone who has MSVC would check that because I just don't see any reason why this should happen. So probably this PR can be closed because I'm unable to fix that. |
OK, closing then until someone comes up with an msvc workaround. |
I found 2 workarounds for this problem, both of them you can see here - https://godbolt.org/z/dvcTjj. I even tested one of them here alexezeder@a3b1c07 and it works. |
In case one of the proposed workarounds is okay, then this PR can be reopened, and then I can add the selected workaround here. |
Sure, thanks for looking into this. I suggest going with the first workaround to avoid introducing unnecessary symbols. |
Thank you! |
Right now formatting of
std::byte
using compile-time API like so:ends up with compilation error, proof on Compiler Explorer. Because there are 2
write
functions which satisfy for the passed typestd::byte
:fmt/include/fmt/format.h
Lines 2114 to 2120 in 5a37e18
fmt/include/fmt/format.h
Lines 2150 to 2162 in 5a37e18
Also, I found
__cpp_lib_byte
feature macro, so all new checks are based on this macro instead of__cplusplus >= 201703L
and I changed old checks accordingly.