diff options
author | zhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386> | 2009-10-01 21:56:16 +0000 |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386> | 2009-10-01 21:56:16 +0000 |
commit | 7c95d8346e9c62e9d6d7e8202fbcfb34c4404db9 (patch) | |
tree | 4208fb4a76d605c834925493e87a3522d7e60682 /include | |
parent | 79643f51ed835bc8c897fb429a9d77a41701d7ad (diff) | |
download | googletest-7c95d8346e9c62e9d6d7e8202fbcfb34c4404db9.tar.gz googletest-7c95d8346e9c62e9d6d7e8202fbcfb34c4404db9.tar.bz2 googletest-7c95d8346e9c62e9d6d7e8202fbcfb34c4404db9.zip |
Works around a Symbian compiler bug that causes memory leak (by Mika Raento).
Diffstat (limited to 'include')
-rw-r--r-- | include/gmock/gmock-spec-builders.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/include/gmock/gmock-spec-builders.h b/include/gmock/gmock-spec-builders.h index 0748d9d4..765e06d9 100644 --- a/include/gmock/gmock-spec-builders.h +++ b/include/gmock/gmock-spec-builders.h @@ -351,10 +351,18 @@ class Mock { // - Constness is shallow: a const Expectation object itself cannot // be modified, but the mutable methods of the ExpectationBase // object it references can be called via expectation_base(). +// - The constructors and destructor are defined out-of-line because +// the Symbian WINSCW compiler wants to otherwise instantiate them +// when it sees this class definition, at which point it doesn't have +// ExpectationBase available yet, leading to incorrect destruction +// in the linked_ptr (or compilation errors if using a checking +// linked_ptr). class Expectation { public: // Constructs a null object that doesn't reference any expectation. - Expectation() {} + Expectation(); + + ~Expectation(); // This single-argument ctor must not be explicit, in order to support the // Expectation e = EXPECT_CALL(...); @@ -399,8 +407,7 @@ class Expectation { typedef ::std::set<Expectation, Less> Set; Expectation( - const internal::linked_ptr<internal::ExpectationBase>& expectation_base) : - expectation_base_(expectation_base) {} + const internal::linked_ptr<internal::ExpectationBase>& expectation_base); // Returns the expectation this object references. const internal::linked_ptr<internal::ExpectationBase>& |