From 796beaaddb5226162fe00c2c55e322d80d26f3d8 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) --- 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 1ed934c1..d926d4ce 100644 --- a/fmt/format.h +++ b/fmt/format.h @@ -1155,7 +1155,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 856c9331..c812b067 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); +} +