Open GoogleCodeExporter opened 8 years ago
Even if the issue has been discovered long time ago and it seems nobody else is
interested. I discovered it now with VC2012 as well. I am using the following
workaround:
- Create a wrapper for 3rd party class with private bool cast operator
- Implement the bool cast for the wrapper class
- Create a mock method with same signature but using the wrapper as
return/parameter value
- Implement the method with the problem with original signature but calling
the mocked method with wrapper
- Define expectations and stuff for mocked method with wrapper
- Add todo to remove when issue has been fixed
Original comment by s.lu...@gmail.com
on 27 Jul 2015 at 6:43
The simplest workaround is to provide a ostream<< operator in the namespace of
Result:
namespace whatever {
ostream &operator<<(ostream &s, const Result &r) {
return s << "Result";
}
} // namespace whatever
It's always a little dangerous (ODR violations etc) to add stuff to other
people's namespaces, but if you either add the above directly to the
third-party include file, or alternatively in your own code making sure it is
included everywhere the third-party include file is included, you should be ok.
Original comment by ko...@google.com
on 7 Aug 2015 at 11:24
Original issue reported on code.google.com by
hyuek...@astaro.com
on 29 Feb 2012 at 2:47