Fix compilation errors with gcc in shared_ptr_unittest.cpp.

This commit is contained in:
David Capello 2010-09-30 16:31:59 -03:00
parent d19e7875e1
commit 9ed888b82b

View File

@ -37,17 +37,18 @@ TEST(SharedPtr, RefCount)
EXPECT_EQ(1, b.getRefCount());
}
class DeleteIsCalled
{
public:
DeleteIsCalled(bool& flag) : m_flag(flag) { }
~DeleteIsCalled() { m_flag = true; }
private:
bool& m_flag;
};
TEST(SharedPtr, DeleteIsCalled)
{
class DeleteIsCalled
{
public:
DeleteIsCalled(bool& flag) : m_flag(flag) { }
~DeleteIsCalled() { m_flag = true; }
private:
bool& m_flag;
};
bool flag = false;
{
SharedPtr<DeleteIsCalled> a(new DeleteIsCalled(flag));
@ -55,10 +56,12 @@ TEST(SharedPtr, DeleteIsCalled)
EXPECT_EQ(true, flag);
}
class A { };
class B : public A { };
TEST(SharedPtr, Hierarchy)
{
class A { };
class B : public A { };
SharedPtr<A> a(new B);
SharedPtr<B> b = a;
SharedPtr<A> c = a;
@ -66,6 +69,7 @@ TEST(SharedPtr, Hierarchy)
EXPECT_EQ(4, a.getRefCount());
}
TEST(SharedPtr, Compare)
{
SharedPtr<int> a(new int(0));