-
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
Reintroduce constexpr fmt::formatted_size for C++20 #4103
Conversation
include/fmt/base.h
Outdated
#ifndef FMT_DETAIL_EXPLICIT_INSTANTIATIONS | ||
FMT_CONSTEXPR20 | ||
#endif |
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.
This looks weird and probably a (benign) ODR violation. Maybe we should disable FMT_CONSTEXPR20
completely on this version of MSVC.
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.
Visual studio 2019 supports C++20 and I think disabling FMT_CONSTEXPR20
for it is a bad idea.
I suggest disable FMT_CONSTEXPR20
only for fmt::formatted_size
(implemented in new commit).
But, I don't see any ODR violation here, since the function body is the same.
If ODR is violated after PR, it must be violated without it due to explicit instantiation
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.
I think the new version is cleaner, let's go with it.
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.
Another solution, but it will break library ABI: remove explicit instantiations for buffer<>::append
.
Version with disabled FMT_CONSTEXPR20 for fmt::formatted_size
on Visual studio 2019 is ready for review.
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
67eb7ed
to
79abecc
Compare
Merged, thanks. |
Fix for #4102
FMT_DETAIL_EXPLICIT_INSTANTIATIONS
is need to fix visual studio 2019 error:https://github.com/phprus/fmt/actions/runs/10221349236/job/28283689340