From d29e4e2d6f37ecfa42b708909bc2425b0bfc6fac Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Mon, 1 May 2017 23:44:37 +0200 Subject: [PATCH] GCC-5 compatibility: ambiguity in overload resolution we have a catch-all template operator to get a string converted or pretty printed output from "any object". Unfortunately this overload counts equivalent to another overload by the IO manipulators. Solution is to define both operarators similar in the first argument, thus turing the overload for the IO manipulators into the more specific overload due to the explicitly given second argument --- src/lib/format-cout.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/format-cout.hpp b/src/lib/format-cout.hpp index 4017dd99a..10840e1a1 100644 --- a/src/lib/format-cout.hpp +++ b/src/lib/format-cout.hpp @@ -76,9 +76,9 @@ namespace std { /** generic overload to use custom string conversions in output */ - template> - ostream& - operator<< (ostream& os, X const& obj) + template> + inline basic_ostream<_CharT, _Traits>& + operator<< (basic_ostream<_CharT, _Traits>& os, X const& obj) { return os << util::StringConv::invoke (obj); } @@ -88,9 +88,9 @@ namespace std { * @note possibly also invokes custom string conversion, * in case the pointee defines one */ - template> - ostream& - operator<< (ostream& os, X const* ptr) + template> + inline basic_ostream<_CharT, _Traits>& + operator<< (basic_ostream<_CharT, _Traits>& os, X const* ptr) { if (ptr) return util::showAddr(os, ptr) << " ↗" << util::StringConv::invoke (*ptr);