diff --git a/fmt/format.h b/fmt/format.h index 7385b76980a2..29927823687c 100644 --- a/fmt/format.h +++ b/fmt/format.h @@ -1153,7 +1153,9 @@ struct ConvertToIntImpl2 { template struct ConvertToInt { - enum { enable_conversion = sizeof(convert(get())) == sizeof(Yes) }; + enum { + enable_conversion = sizeof(fmt::internal::convert(get())) == sizeof(Yes) + }; enum { value = ConvertToIntImpl2::value }; }; diff --git a/test/format-test.cc b/test/format-test.cc index a3eb907e8505..e8037dcac7b1 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -1653,3 +1653,11 @@ FMT_VARIADIC(void, custom_format, const char *) TEST(FormatTest, CustomArgFormatter) { 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); +} +