diff options
author | zhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386> | 2011-04-14 19:37:06 +0000 |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386> | 2011-04-14 19:37:06 +0000 |
commit | 8d3dc0cdd870ecc53d8a8ba30566b3cd70910863 (patch) | |
tree | 4b1f0d5319d0f31df63166329cc734fb73b30377 /include | |
parent | 8d7c5ad6d3f8aa9715815613b5d244bd4a0e073e (diff) | |
download | googletest-8d3dc0cdd870ecc53d8a8ba30566b3cd70910863.tar.gz googletest-8d3dc0cdd870ecc53d8a8ba30566b3cd70910863.tar.bz2 googletest-8d3dc0cdd870ecc53d8a8ba30566b3cd70910863.zip |
simplifies TrulyMatcher and adds a test for it
Diffstat (limited to 'include')
-rw-r--r-- | include/gmock/gmock-matchers.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/include/gmock/gmock-matchers.h b/include/gmock/gmock-matchers.h index b92450ca..c21fa515 100644 --- a/include/gmock/gmock-matchers.h +++ b/include/gmock/gmock-matchers.h @@ -1392,15 +1392,15 @@ class TrulyMatcher { template <typename T> bool MatchAndExplain(T& x, // NOLINT MatchResultListener* /* listener */) const { -#ifdef _MSC_VER - // MSVC warns about converting a value into bool (warning 4800). -# pragma warning(push) // Saves the current warning state. -# pragma warning(disable:4800) // Temporarily disables warning 4800. -#endif - return predicate_(x); -#ifdef _MSC_VER -# pragma warning(pop) // Restores the warning state. -#endif + // Without the if-statement, MSVC sometimes warns about converting + // a value to bool (warning 4800). + // + // We cannot write 'return !!predicate_(x);' as that doesn't work + // when predicate_(x) returns a class convertible to bool but + // having no operator!(). + if (predicate_(x)) + return true; + return false; } void DescribeTo(::std::ostream* os) const { |