aboutsummaryrefslogtreecommitdiffstats
path: root/include/gmock/gmock-more-actions.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/gmock/gmock-more-actions.h')
-rw-r--r--include/gmock/gmock-more-actions.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/gmock/gmock-more-actions.h b/include/gmock/gmock-more-actions.h
index 9a6fe969..6d686cd1 100644
--- a/include/gmock/gmock-more-actions.h
+++ b/include/gmock/gmock-more-actions.h
@@ -198,7 +198,17 @@ ACTION_TEMPLATE(DeleteArg,
// Action Throw(exception) can be used in a mock function of any type
// to throw the given exception. Any copyable value can be thrown.
#if GTEST_HAS_EXCEPTIONS
+
+// Suppresses the 'unreachable code' warning that VC generates in opt modes.
+#ifdef _MSC_VER
+#pragma warning(push) // Saves the current warning state.
+#pragma warning(disable:4702) // Temporarily disables warning 4702.
+#endif
ACTION_P(Throw, exception) { throw exception; }
+#ifdef _MSC_VER
+#pragma warning(pop) // Restores the warning state.
+#endif
+
#endif // GTEST_HAS_EXCEPTIONS
#ifdef _MSC_VER