-
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 compilation errors due to make_format_args
in gcc 14.1.1 with c++20
#4042
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! The fix looks correct but could you add a test case to https://github.com/fmtlib/fmt/blob/master/test/printf-test.cc to prevent regression?
@vitaut |
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.
Looks like some .gradle files were added accidentally.
test/CMakeLists.txt
Outdated
# use C++20 if C++20 is available for https://github.com/fmtlib/fmt/pull/4042 | ||
get_property(cxx_features GLOBAL PROPERTY CMAKE_CXX_KNOWN_FEATURES) | ||
if(cxx_std_20 IN_LIST cxx_features) | ||
target_compile_features(${name} PRIVATE cxx_std_20) | ||
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 standard should be controlled externally, not here. Let's revert.
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.
@vitaut
Sorry I try to revert both cxx_std and .gradle files.
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.
@vitaut
Now I finished.
Cloud you review it again?
test/printf-test.cc
Outdated
@@ -6,6 +6,10 @@ | |||
// For the license information refer to format.h. | |||
|
|||
#include "fmt/printf.h" | |||
// include <format> if possible for https://github.com/fmtlib/fmt/pull/4042 | |||
#if defined(__has_include) && __has_include(<format>) |
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.
#if FMT_HAS_INCLUDE(<format>) && FMT_CPLUSPLUS > 201703L
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.
@phprus
Thanks a lot!
Fixed.
Thank you! |
In gcc 14.1.1 with c++20, there are compilation errors following code:
The error messages are like this:
It seems to be caused by recursive
make_printf_args
calls without namespace.This PR tries to solve it.
I think this is an adhoc approach, so if there is a more elegant way,
I will gladly close this PR.