[libcxx] r243733 - Fix failing unique_ptr tests.

Eric Fiselier eric at efcs.ca
Thu Jul 30 21:34:26 PDT 2015


Author: ericwf
Date: Thu Jul 30 23:34:25 2015
New Revision: 243733

URL: http://llvm.org/viewvc/llvm-project?rev=243733&view=rev
Log:
Fix failing unique_ptr tests.

When I was refactoring the unique_ptr.single.ctor tests I added a test
deleter, 'NCDeleter', to deleter.h. Other tests that include deleter.h
redefine the NCDeleter type causing test failures.

Modified:
    libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.pass.cpp
    libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp

Modified: libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.pass.cpp?rev=243733&r1=243732&r2=243733&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move01.pass.cpp Thu Jul 30 23:34:25 2015
@@ -32,22 +32,6 @@ struct A
 
 int A::count = 0;
 
-class NCDeleter
-{
-    int state_;
-
-    NCDeleter(NCDeleter&);
-    NCDeleter& operator=(NCDeleter&);
-public:
-
-    NCDeleter() : state_(5) {}
-
-    int state() const {return state_;}
-    void set_state(int s) {state_ = s;}
-
-    void operator()(A* p) {delete [] p;}
-};
-
 int main()
 {
     {
@@ -71,10 +55,10 @@ int main()
     }
     assert(A::count == 0);
     {
-    NCDeleter d;
-    std::unique_ptr<A[], NCDeleter&> s(new A[3], d);
+    NCDeleter<A[]> d;
+    std::unique_ptr<A[], NCDeleter<A[]>&> s(new A[3], d);
     A* p = s.get();
-    std::unique_ptr<A[], NCDeleter&> s2 = std::move(s);
+    std::unique_ptr<A[], NCDeleter<A[]>&> s2 = std::move(s);
     assert(s2.get() == p);
     assert(s.get() == 0);
     assert(A::count == 3);

Modified: libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp?rev=243733&r1=243732&r2=243733&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/move02.pass.cpp Thu Jul 30 23:34:25 2015
@@ -31,21 +31,6 @@ struct A
 
 int A::count = 0;
 
-class NCDeleter
-{
-    int state_;
-
-    NCDeleter(NCDeleter&);
-    NCDeleter& operator=(NCDeleter&);
-public:
-
-    NCDeleter() : state_(5) {}
-
-    int state() const {return state_;}
-    void set_state(int s) {state_ = s;}
-
-    void operator()(A* p) {delete [] p;}
-};
 
 std::unique_ptr<A[]>
 source1()
@@ -67,14 +52,14 @@ void sink2(std::unique_ptr<A[], Deleter<
 {
 }
 
-std::unique_ptr<A[], NCDeleter&>
+std::unique_ptr<A[], NCDeleter<A[]>&>
 source3()
 {
-    static NCDeleter d;
-    return std::unique_ptr<A[], NCDeleter&>(new A[3], d);
+    static NCDeleter<A[]> d;
+    return std::unique_ptr<A[], NCDeleter<A[]>&>(new A[3], d);
 }
 
-void sink3(std::unique_ptr<A[], NCDeleter&> p)
+void sink3(std::unique_ptr<A[], NCDeleter<A[]>&> p)
 {
 }
 





More information about the cfe-commits mailing list