From da783abee94d718ab7c2954b2f016a858263f69b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Thu, 15 Feb 2018 15:16:23 +0100 Subject: [PATCH] Move fallback conversion after enum-check --- include/internal/catch_tostring.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/include/internal/catch_tostring.h b/include/internal/catch_tostring.h index 89909906..bb9cb0be 100644 --- a/include/internal/catch_tostring.h +++ b/include/internal/catch_tostring.h @@ -61,8 +61,13 @@ namespace Catch { std::string convertUnknownEnumToString( E e ); template - typename std::enable_if::value, std::string>::type convertUnstreamable( T const& ) { + typename std::enable_if::value, std::string>::type convertUnstreamable( T const& value ) { +#if !defined(CATCH_CONFIG_FALLBACK_STRINGIFIER) + (void)value; return Detail::unprintableString; +#else + return CATCH_CONFIG_FALLBACK_STRINGIFIER(value); +#endif } template typename std::enable_if::value, std::string>::type convertUnstreamable( T const& value ) { @@ -88,11 +93,7 @@ namespace Catch { static typename std::enable_if::value, std::string>::type convert( const Fake& value ) { -#if !defined(CATCH_CONFIG_FALLBACK_STRINGIFIER) return Detail::convertUnstreamable( value ); -#else - return CATCH_CONFIG_FALLBACK_STRINGIFIER( value ); -#endif } };