Exclude string-literal arrays from automatic range serialisation

These have specialised serialisers already anyway, and were causing ambiguities in VS 2015 & 2017
This commit is contained in:
Phil Nash 2018-01-08 15:15:44 +00:00
parent 161dd4ed24
commit 421ab16062

View File

@ -136,6 +136,18 @@ namespace Catch {
static std::string convert(wchar_t * str); static std::string convert(wchar_t * str);
}; };
template<typename T>
struct is_string_array : std::false_type {};
template<std::size_t N>
struct is_string_array<char[N]> : std::true_type {};
template<std::size_t N>
struct is_string_array<signed char[N]> : std::true_type {};
template<std::size_t N>
struct is_string_array<unsigned char[N]> : std::true_type {};
template<int SZ> template<int SZ>
struct StringMaker<char[SZ]> { struct StringMaker<char[SZ]> {
static std::string convert(const char* str) { static std::string convert(const char* str) {
@ -387,7 +399,7 @@ namespace Catch {
} }
template<typename R> template<typename R>
struct StringMaker<R, typename std::enable_if<is_range<R>::value>::type> { struct StringMaker<R, typename std::enable_if<is_range<R>::value && !is_string_array<R>::value>::type> {
static std::string convert( R const& range ) { static std::string convert( R const& range ) {
return rangeToString( range ); return rangeToString( range );
} }