From f682bff3a72dee9e3645210002d2a5ccc884e324 Mon Sep 17 00:00:00 2001 From: Antony Polukhin Date: Sun, 11 Nov 2012 08:59:36 +0000 Subject: [PATCH] Simplify `test_getting_pointer_to_function` to don't deal with compilers bugs and just test that getting pointer to lexical_cast is not ambiguous [SVN r81294] --- lexical_cast_test.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lexical_cast_test.cpp b/lexical_cast_test.cpp index 87b8ea8..6ac4d9b 100644 --- a/lexical_cast_test.cpp +++ b/lexical_cast_test.cpp @@ -607,17 +607,21 @@ void test_char32_conversions() } #endif -template -To try_cast_by_ptr(const From& from, Func f) { - return f(from); -}; - void test_getting_pointer_to_function() { // Just checking that &lexical_cast is not ambiguous - BOOST_CHECK_EQUAL(100, try_cast_by_ptr("100", &boost::lexical_cast)); - BOOST_CHECK_EQUAL(100, try_cast_by_ptr("100", &boost::lexical_cast)); - BOOST_CHECK_EQUAL(std::string("100"), try_cast_by_ptr(100, &boost::lexical_cast)); + typedef char char_arr[4]; + typedef int(*f1)(const char_arr&); + f1 p1 = &boost::lexical_cast; + BOOST_CHECK(p1); + + typedef int(*f2)(const std::string&); + f2 p2 = &boost::lexical_cast; + BOOST_CHECK(p2); + + typedef std::string(*f3)(const int&); + f3 p3 = &boost::lexical_cast; + BOOST_CHECK(p3); }