Fix enable_shared_from_this test in C++11
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@302721 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -50,7 +50,6 @@ struct Bar : public Foo {
|
||||
|
||||
|
||||
struct PrivateBase : private std::enable_shared_from_this<PrivateBase> {
|
||||
std::weak_ptr<PrivateBase> get_weak() { return weak_from_this(); }
|
||||
};
|
||||
|
||||
|
||||
@@ -79,12 +78,12 @@ int main()
|
||||
assert(p == q);
|
||||
assert(!p.owner_before(q) && !q.owner_before(p)); // p and q share ownership
|
||||
}
|
||||
{
|
||||
typedef std::shared_ptr<PrivateBase> APtr;
|
||||
typedef std::weak_ptr<PrivateBase> WeakAPtr;
|
||||
APtr a1 = std::make_shared<PrivateBase>();
|
||||
assert(a1.use_count() == 1);
|
||||
}
|
||||
{
|
||||
typedef std::shared_ptr<PrivateBase> APtr;
|
||||
typedef std::weak_ptr<PrivateBase> WeakAPtr;
|
||||
APtr a1 = std::make_shared<PrivateBase>();
|
||||
assert(a1.use_count() == 1);
|
||||
}
|
||||
// Test LWG issue 2529. Only reset '__weak_ptr_' when it's already expired.
|
||||
// http://cplusplus.github.io/LWG/lwg-active.html#2529.
|
||||
// Test two different ways:
|
||||
|
||||
Reference in New Issue
Block a user