mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 02:37:36 +02:00
Fix collision with global convert function (#425)
(cherry picked from commit 796beaaddb
)
This commit is contained in:
committed by
Jonathan Müller
parent
baedba07ca
commit
a55df13598
@ -1153,7 +1153,9 @@ struct ConvertToIntImpl2<T, true> {
|
|||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct ConvertToInt {
|
struct ConvertToInt {
|
||||||
enum { enable_conversion = sizeof(convert(get<T>())) == sizeof(Yes) };
|
enum {
|
||||||
|
enable_conversion = sizeof(fmt::internal::convert(get<T>())) == sizeof(Yes)
|
||||||
|
};
|
||||||
enum { value = ConvertToIntImpl2<T, enable_conversion>::value };
|
enum { value = ConvertToIntImpl2<T, enable_conversion>::value };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1653,3 +1653,11 @@ FMT_VARIADIC(void, custom_format, const char *)
|
|||||||
TEST(FormatTest, CustomArgFormatter) {
|
TEST(FormatTest, CustomArgFormatter) {
|
||||||
custom_format("{}", 42);
|
custom_format("{}", 42);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void convert(int);
|
||||||
|
|
||||||
|
// Check if there is no collision with convert function in the global namespace.
|
||||||
|
TEST(FormatTest, ConvertCollision) {
|
||||||
|
fmt::format("{}", 42);
|
||||||
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user