Fix build under msvc
diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h
index 3662520..f2e47ef 100644
--- a/googlemock/include/gmock/gmock-matchers.h
+++ b/googlemock/include/gmock/gmock-matchers.h
@@ -4734,6 +4734,13 @@
template <typename Err>
class ExceptionMatcherImpl {
+ class NeverThrown {
+ public:
+ const char* what() const noexcept {
+ return "this exception should never be thrown";
+ }
+ };
+
public:
ExceptionMatcherImpl(Matcher<const Err&> matcher)
: matcher_(std::move(matcher)) {}
@@ -4764,7 +4771,14 @@
} else {
return true;
}
- } catch (const std::exception& err) {
+ } catch (
+ typename std::conditional<
+ std::is_same<
+ typename std::remove_cv<
+ typename std::remove_reference<Err>::type>::type,
+ std::exception>::value,
+ const NeverThrown&,
+ const std::exception&>::type const& err) {
#if GTEST_HAS_RTTI
*listener << "throws an exception of type "
<< GetTypeName(typeid(err)) << " ";