Fix ambiguity in stringification

Happening when using clang and templated operators, clang cannot decide
between the operator provided by ReusableStringStream and the one provided
by the value value as both are templates. This is easily solved by calling
the operator<< through the member syntax.

Fixes #1285
This commit is contained in:
Julien Nitard authored and Martin Hořeňovský committed 2018-06-06 22:33:03 +02:00
1 parent 021fcee636
commit 7be8a41adf
7 files changed
+54 -8

No files matched your search

+3 -1
View File
@@ -105,7 +105,9 @@ namespace Catch {
typename std::enable_if<::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type
convert(const Fake& value) {
ReusableStringStream rss;
rss << value;
// NB: call using the function-like syntax to avoid ambiguity with
// user-defined templated operator<< under clang.
rss.operator<<(value);
return rss.str();
}