From 4c7b7d04fe304d575b7f683db33eb6a7d11ca888 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Mon, 14 May 2018 19:46:30 +0200 Subject: [PATCH] Move FALLBACK_STRINGIFIER to before the enum and range fallbacks This should align more closely with the intended semantics, where types without `StringMaker` specialization or `operator<<` overload are passed down to the user defined fallback stringifier. Related to #1024 --- include/internal/catch_tostring.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/include/internal/catch_tostring.h b/include/internal/catch_tostring.h index 4c7f0366..81c87231 100644 --- a/include/internal/catch_tostring.h +++ b/include/internal/catch_tostring.h @@ -64,13 +64,8 @@ namespace Catch { template typename std::enable_if< !std::is_enum::value && !std::is_base_of::value, - std::string>::type convertUnstreamable( T const& value ) { -#if !defined(CATCH_CONFIG_FALLBACK_STRINGIFIER) - (void)value; + std::string>::type convertUnstreamable( T const& ) { return Detail::unprintableString; -#else - return CATCH_CONFIG_FALLBACK_STRINGIFIER(value); -#endif } template typename std::enable_if< @@ -118,7 +113,11 @@ namespace Catch { static typename std::enable_if::value, std::string>::type convert( const Fake& value ) { - return Detail::convertUnstreamable( value ); +#if !defined(CATCH_CONFIG_FALLBACK_STRINGIFIER) + return Detail::convertUnstreamable(value); +#else + return CATCH_CONFIG_FALLBACK_STRINGIFIER(value); +#endif } };