[libcxx] r302721 - Fix enable_shared_from_this test in C++11

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Wed May 10 13:09:20 PDT 2017


Author: ericwf
Date: Wed May 10 15:09:20 2017
New Revision: 302721

URL: http://llvm.org/viewvc/llvm-project?rev=302721&view=rev
Log:
Fix enable_shared_from_this test in C++11

Modified:
    libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp

Modified: libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp?rev=302721&r1=302720&r2=302721&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp Wed May 10 15:09:20 2017
@@ -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:




More information about the cfe-commits mailing list