diff options
author | kosak <kosak@google.com> | 2015-01-08 03:03:09 +0000 |
---|---|---|
committer | kosak <kosak@google.com> | 2015-01-08 03:03:09 +0000 |
commit | 53d49dc43ea3f34a61f4a017d33ac5a0b650a68d (patch) | |
tree | caeeb19d2e1a04c16c23f0f46211a092c948f77f /include/gmock/gmock-actions.h | |
parent | 8e838ce0fd145431b433f534c71bdb7f5d6b11ac (diff) | |
download | googletest-53d49dc43ea3f34a61f4a017d33ac5a0b650a68d.tar.gz googletest-53d49dc43ea3f34a61f4a017d33ac5a0b650a68d.tar.bz2 googletest-53d49dc43ea3f34a61f4a017d33ac5a0b650a68d.zip |
Make ReturnNull() support unique_ptr and shared_ptr.
Diffstat (limited to 'include/gmock/gmock-actions.h')
-rw-r--r-- | include/gmock/gmock-actions.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/gmock/gmock-actions.h b/include/gmock/gmock-actions.h index f92e479f..46b7bf9d 100644 --- a/include/gmock/gmock-actions.h +++ b/include/gmock/gmock-actions.h @@ -583,12 +583,18 @@ class ReturnAction { // Implements the ReturnNull() action. class ReturnNullAction { public: - // Allows ReturnNull() to be used in any pointer-returning function. + // Allows ReturnNull() to be used in any pointer-returning function. In C++11 + // this is enforced by returning nullptr, and in non-C++11 by asserting a + // pointer type on compile time. template <typename Result, typename ArgumentTuple> static Result Perform(const ArgumentTuple&) { +#if GTEST_LANG_CXX11 + return nullptr; +#else GTEST_COMPILE_ASSERT_(internal::is_pointer<Result>::value, ReturnNull_can_be_used_to_return_a_pointer_only); return NULL; +#endif // GTEST_LANG_CXX11 } }; |