Adjust two tests to account for a nasty change in copying behavior
between C++03 and C++0x and its effect on exceptions, and another two to not test move construction when rvalue references are not available. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135445 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
13aaf422e4
commit
541cb301a1
@ -42,6 +42,7 @@ int A::count = 0;
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
{
|
{
|
||||||
std::shared_ptr<A> pA(new A);
|
std::shared_ptr<A> pA(new A);
|
||||||
A* ptrA = pA.get();
|
A* ptrA = pA.get();
|
||||||
@ -118,4 +119,5 @@ int main()
|
|||||||
}
|
}
|
||||||
assert(B::count == 0);
|
assert(B::count == 0);
|
||||||
assert(A::count == 0);
|
assert(A::count == 0);
|
||||||
|
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,7 @@ int A::count = 0;
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
{
|
{
|
||||||
std::shared_ptr<A> pA(new A);
|
std::shared_ptr<A> pA(new A);
|
||||||
A* ptrA = pA.get();
|
A* ptrA = pA.get();
|
||||||
@ -118,4 +119,5 @@ int main()
|
|||||||
}
|
}
|
||||||
assert(B::count == 0);
|
assert(B::count == 0);
|
||||||
assert(A::count == 0);
|
assert(A::count == 0);
|
||||||
|
#endif // _LIBCXX_HAS_NO_RVALUE_REFERENCES
|
||||||
}
|
}
|
||||||
|
@ -85,9 +85,17 @@ int main()
|
|||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
assert(A::count == 1);
|
assert(A::count == 1);
|
||||||
assert(B::count == 1);
|
assert(B::count == 1);
|
||||||
assert(ptr.get() == raw_ptr);
|
assert(ptr.get() == raw_ptr);
|
||||||
|
#else
|
||||||
|
// Without rvalue references, ptr got copied into
|
||||||
|
// the shared_ptr destructor and the copy was
|
||||||
|
// destroyed during unwinding.
|
||||||
|
assert(A::count == 0);
|
||||||
|
assert(B::count == 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(A::count == 0);
|
assert(A::count == 0);
|
||||||
|
@ -77,9 +77,15 @@ int main()
|
|||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
assert(A::count == 1);
|
assert(A::count == 1);
|
||||||
assert(B::count == 1);
|
assert(B::count == 1);
|
||||||
assert(ptr.get() == raw_ptr);
|
assert(ptr.get() == raw_ptr);
|
||||||
|
#else
|
||||||
|
assert(A::count == 0);
|
||||||
|
assert(B::count == 0);
|
||||||
|
assert(ptr.get() == 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(A::count == 0);
|
assert(A::count == 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user