summaryrefslogtreecommitdiffstats
path: root/googlemock
diff options
context:
space:
mode:
authorVladimir Goncharov <amatanhead@yandex-team.ru>2020-07-07 16:28:24 (GMT)
committerVladimir Goncharov <amatanhead@yandex-team.ru>2020-08-03 20:47:57 (GMT)
commit0a80845e73d5b6c87c87eec6b5777224542d8bd9 (patch)
treed8a8092e199bac5e886f951297be7c8c47c5fa64 /googlemock
parent92d0a6f7e2dafe49377669884e665026fc1aa376 (diff)
downloadgoogletest-0a80845e73d5b6c87c87eec6b5777224542d8bd9.zip
googletest-0a80845e73d5b6c87c87eec6b5777224542d8bd9.tar.gz
googletest-0a80845e73d5b6c87c87eec6b5777224542d8bd9.tar.bz2
Fix build under msvc
Diffstat (limited to 'googlemock')
-rw-r--r--googlemock/include/gmock/gmock-matchers.h16
1 files changed, 15 insertions, 1 deletions
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 @@ namespace internal {
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 @@ class ExceptionMatcherImpl {
} 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)) << " ";