From 201ac161919b2c7f464b4f966a4f1a1a2379c486 Mon Sep 17 00:00:00 2001 From: vladlosev Date: Wed, 18 Nov 2009 00:12:05 +0000 Subject: Enables gmock's implicit_cast to work with source types that have a non-const conversion operator (by Zhanyong Wan). --- include/gmock/internal/gmock-port.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/gmock/internal/gmock-port.h b/include/gmock/internal/gmock-port.h index 0263491e..1bd455b2 100644 --- a/include/gmock/internal/gmock-port.h +++ b/include/gmock/internal/gmock-port.h @@ -99,9 +99,21 @@ namespace internal { // but the proposal was submitted too late. It will probably make // its way into the language in the future. template -inline To implicit_cast(From const &f) { +inline To implicit_cast(const From& f) { return f; } +// Nokia's compiler can't tell which version of implicit_cast to use when +// the source is a const, causing the compilation to fail with the error +// "ambiguous access to overloaded function". So we only support the const +// version of implicit_cast on Symbian. +#if !GTEST_OS_SYMBIAN +// This overload is needed in case the From type has a non-const type +// conversion operator to type To. +template +inline To implicit_cast(From& f) { + return f; +} +#endif // When you upcast (that is, cast a pointer from type Foo to type // SuperclassOfFoo), it's fine to use implicit_cast<>, since upcasts -- cgit v1.2.3