From a55df13598aa3bba398e479fcb2d5c242466f81c Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sat, 19 Nov 2016 12:05:49 -0800 Subject: [PATCH] Fix collision with global convert function (#425) (cherry picked from commit 796beaaddb5226162fe00c2c55e322d80d26f3d8) --- fmt/format.h | 4 +++- test/format-test.cc | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/fmt/format.h b/fmt/format.h index 7385b769..29927823 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 a3eb907e..e8037dca 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); +} +