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
This commit is contained in:
Martin Hořeňovský 2018-05-14 19:46:30 +02:00
parent 90988f578c
commit 4c7b7d04fe

View File

@ -64,13 +64,8 @@ namespace Catch {
template<typename T> template<typename T>
typename std::enable_if< typename std::enable_if<
!std::is_enum<T>::value && !std::is_base_of<std::exception, T>::value, !std::is_enum<T>::value && !std::is_base_of<std::exception, T>::value,
std::string>::type convertUnstreamable( T const& value ) { std::string>::type convertUnstreamable( T const& ) {
#if !defined(CATCH_CONFIG_FALLBACK_STRINGIFIER)
(void)value;
return Detail::unprintableString; return Detail::unprintableString;
#else
return CATCH_CONFIG_FALLBACK_STRINGIFIER(value);
#endif
} }
template<typename T> template<typename T>
typename std::enable_if< typename std::enable_if<
@ -118,7 +113,11 @@ namespace Catch {
static static
typename std::enable_if<!::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type typename std::enable_if<!::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type
convert( const Fake& value ) { 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
} }
}; };