diff --git a/include/internal/catch_tostring.hpp b/include/internal/catch_tostring.hpp index fef7ad3a..a980504a 100644 --- a/include/internal/catch_tostring.hpp +++ b/include/internal/catch_tostring.hpp @@ -86,7 +86,8 @@ struct StringMaker : template struct StringMaker { - static std::string convert( T const* p ) { + template + static std::string convert( U* p ) { if( !p ) return INTERNAL_CATCH_STRINGIFY( NULL ); std::ostringstream oss; diff --git a/projects/SelfTest/TrickyTests.cpp b/projects/SelfTest/TrickyTests.cpp index 97386709..0a81ad83 100644 --- a/projects/SelfTest/TrickyTests.cpp +++ b/projects/SelfTest/TrickyTests.cpp @@ -342,6 +342,28 @@ TEST_CASE( "non streamable - with conv. op", "" ) REQUIRE( s == "7" ); } +inline void foo() {} + +typedef void (*fooptr_t)(); + +TEST_CASE( "Comparing function pointers", "[function pointer]" ) +{ + // This was giving a warning in VS2010 + // #179 + fooptr_t a = foo; + + REQUIRE( a ); + REQUIRE( a == &foo ); +} + +class ClassName {}; + +TEST_CASE( "pointer to class", "" ) +{ + ClassName *p = 0; + REQUIRE( p != 0 ); +} + #ifdef CATCH_CONFIG_CPP11_NULLPTR #include