summaryrefslogtreecommitdiffstats
path: root/libcxx/test/depr/depr.auto.ptr
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/depr/depr.auto.ptr')
-rw-r--r--libcxx/test/depr/depr.auto.ptr/auto.ptr/A.h30
-rw-r--r--libcxx/test/depr/depr.auto.ptr/auto.ptr/AB.h41
-rw-r--r--libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/assignment.fail.cpp44
-rw-r--r--libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/assignment.pass.cpp44
-rw-r--r--libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert.fail.cpp40
-rw-r--r--libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert.pass.cpp40
-rw-r--r--libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert_assignment.fail.cpp47
-rw-r--r--libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert_assignment.pass.cpp47
-rw-r--r--libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/copy.fail.cpp38
-rw-r--r--libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/copy.pass.cpp38
-rw-r--r--libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/explicit.fail.cpp40
-rw-r--r--libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/pointer.pass.cpp40
-rw-r--r--libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/assign_from_auto_ptr_ref.pass.cpp40
-rw-r--r--libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_from_auto_ptr_ref.pass.cpp39
-rw-r--r--libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr.pass.cpp36
-rw-r--r--libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr_ref.pass.cpp33
-rw-r--r--libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/arrow.pass.cpp37
-rw-r--r--libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/deref.pass.cpp37
-rw-r--r--libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/release.pass.cpp38
-rw-r--r--libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/reset.pass.cpp54
-rw-r--r--libcxx/test/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp36
-rw-r--r--libcxx/test/depr/depr.auto.ptr/nothing_to_do.pass.cpp12
22 files changed, 851 insertions, 0 deletions
diff --git a/libcxx/test/depr/depr.auto.ptr/auto.ptr/A.h b/libcxx/test/depr/depr.auto.ptr/auto.ptr/A.h
new file mode 100644
index 00000000000..cab46e37ebe
--- /dev/null
+++ b/libcxx/test/depr/depr.auto.ptr/auto.ptr/A.h
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef A_H
+#define A_H
+
+#include <cassert>
+
+class A
+{
+ int id_;
+public:
+ explicit A(int id) : id_(id) {++count;}
+ A(const A& a) : id_(a.id_) {++count;}
+ ~A() {assert(id_ >= 0); id_ = -1; --count;}
+
+ int id() const {return id_;}
+
+ static int count;
+};
+
+int A::count = 0;
+
+#endif
diff --git a/libcxx/test/depr/depr.auto.ptr/auto.ptr/AB.h b/libcxx/test/depr/depr.auto.ptr/auto.ptr/AB.h
new file mode 100644
index 00000000000..a78f4746e14
--- /dev/null
+++ b/libcxx/test/depr/depr.auto.ptr/auto.ptr/AB.h
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef AB_H
+#define AB_H
+
+#include <cassert>
+
+class A
+{
+ int id_;
+public:
+ explicit A(int id) : id_(id) {++count;}
+ A(const A& a) : id_(a.id_) {++count;}
+ virtual ~A() {assert(id_ >= 0); id_ = -1; --count;}
+
+ static int count;
+};
+
+int A::count = 0;
+
+class B
+ : public A
+{
+public:
+ explicit B(int id) : A(id) {++count;}
+ B(const B& a) : A(a) {++count;}
+ virtual ~B() {--count;}
+
+ static int count;
+};
+
+int B::count = 0;
+
+#endif
diff --git a/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/assignment.fail.cpp b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/assignment.fail.cpp
new file mode 100644
index 00000000000..4ab223dd0f1
--- /dev/null
+++ b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/assignment.fail.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class X> class auto_ptr;
+
+// auto_ptr& operator=(auto_ptr& a) throw();
+
+#include <memory>
+#include <cassert>
+
+#include "../A.h"
+
+void
+test()
+{
+ {
+ A* p1 = new A(1);
+ const std::auto_ptr<A> ap1(p1);
+ A* p2 = new A(2);
+ std::auto_ptr<A> ap2(p2);
+ assert(A::count == 2);
+ assert(ap1.get() == p1);
+ assert(ap2.get() == p2);
+ std::auto_ptr<A>& apr = ap2 = ap1;
+ assert(&apr == &ap2);
+ assert(A::count == 1);
+ assert(ap1.get() == 0);
+ assert(ap2.get() == p1);
+ }
+ assert(A::count == 0);
+}
+
+int main()
+{
+ test();
+}
diff --git a/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/assignment.pass.cpp b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/assignment.pass.cpp
new file mode 100644
index 00000000000..7fa870163cb
--- /dev/null
+++ b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/assignment.pass.cpp
@@ -0,0 +1,44 @@
+//===----------------------------------------------------------------------===//
+//
+// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class X> class auto_ptr;
+
+// auto_ptr& operator=(auto_ptr& a) throw();
+
+#include <memory>
+#include <cassert>
+
+#include "../A.h"
+
+void
+test()
+{
+ {
+ A* p1 = new A(1);
+ std::auto_ptr<A> ap1(p1);
+ A* p2 = new A(2);
+ std::auto_ptr<A> ap2(p2);
+ assert(A::count == 2);
+ assert(ap1.get() == p1);
+ assert(ap2.get() == p2);
+ std::auto_ptr<A>& apr = ap2 = ap1;
+ assert(&apr == &ap2);
+ assert(A::count == 1);
+ assert(ap1.get() == 0);
+ assert(ap2.get() == p1);
+ }
+ assert(A::count == 0);
+}
+
+int main()
+{
+ test();
+}
diff --git a/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert.fail.cpp b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert.fail.cpp
new file mode 100644
index 00000000000..337af87b819
--- /dev/null
+++ b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert.fail.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class X> class auto_ptr;
+
+// auto_ptr(auto_ptr& a) throw();
+
+#include <memory>
+#include <cassert>
+
+#include "../AB.h"
+
+void
+test()
+{
+ {
+ B* p = new B(1);
+ const std::auto_ptr<B> ap1(p);
+ std::auto_ptr<A> ap2(ap1);
+ assert(ap1.get() == 0);
+ assert(ap2.get() == p);
+ assert(A::count == 1);
+ assert(B::count == 1);
+ }
+ assert(A::count == 0);
+ assert(B::count == 0);
+}
+
+int main()
+{
+ test();
+}
diff --git a/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert.pass.cpp b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert.pass.cpp
new file mode 100644
index 00000000000..d2835b02f3f
--- /dev/null
+++ b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class X> class auto_ptr;
+
+// auto_ptr(auto_ptr& a) throw();
+
+#include <memory>
+#include <cassert>
+
+#include "../AB.h"
+
+void
+test()
+{
+ {
+ B* p = new B(1);
+ std::auto_ptr<B> ap1(p);
+ std::auto_ptr<A> ap2(ap1);
+ assert(ap1.get() == 0);
+ assert(ap2.get() == p);
+ assert(A::count == 1);
+ assert(B::count == 1);
+ }
+ assert(A::count == 0);
+ assert(B::count == 0);
+}
+
+int main()
+{
+ test();
+}
diff --git a/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert_assignment.fail.cpp b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert_assignment.fail.cpp
new file mode 100644
index 00000000000..3964ee600b5
--- /dev/null
+++ b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert_assignment.fail.cpp
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class X> class auto_ptr;
+
+// template<class Y> auto_ptr& operator=(auto_ptr<Y>& a) throw();
+
+#include <memory>
+#include <cassert>
+
+#include "../AB.h"
+
+void
+test()
+{
+ {
+ B* p1 = new B(1);
+ const std::auto_ptr<B> ap1(p1);
+ A* p2 = new A(2);
+ std::auto_ptr<A> ap2(p2);
+ assert(A::count == 2);
+ assert(B::count == 1);
+ assert(ap1.get() == p1);
+ assert(ap2.get() == p2);
+ std::auto_ptr<A>& apr = ap2 = ap1;
+ assert(&apr == &ap2);
+ assert(A::count == 1);
+ assert(B::count == 1);
+ assert(ap1.get() == 0);
+ assert(ap2.get() == p1);
+ }
+ assert(A::count == 0);
+ assert(B::count == 0);
+}
+
+int main()
+{
+ test();
+}
diff --git a/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert_assignment.pass.cpp b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert_assignment.pass.cpp
new file mode 100644
index 00000000000..67e58f46a7e
--- /dev/null
+++ b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert_assignment.pass.cpp
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class X> class auto_ptr;
+
+// template<class Y> auto_ptr& operator=(auto_ptr<Y>& a) throw();
+
+#include <memory>
+#include <cassert>
+
+#include "../AB.h"
+
+void
+test()
+{
+ {
+ B* p1 = new B(1);
+ std::auto_ptr<B> ap1(p1);
+ A* p2 = new A(2);
+ std::auto_ptr<A> ap2(p2);
+ assert(A::count == 2);
+ assert(B::count == 1);
+ assert(ap1.get() == p1);
+ assert(ap2.get() == p2);
+ std::auto_ptr<A>& apr = ap2 = ap1;
+ assert(&apr == &ap2);
+ assert(A::count == 1);
+ assert(B::count == 1);
+ assert(ap1.get() == 0);
+ assert(ap2.get() == p1);
+ }
+ assert(A::count == 0);
+ assert(B::count == 0);
+}
+
+int main()
+{
+ test();
+}
diff --git a/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/copy.fail.cpp b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/copy.fail.cpp
new file mode 100644
index 00000000000..222e585889d
--- /dev/null
+++ b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/copy.fail.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class X> class auto_ptr;
+
+// auto_ptr(auto_ptr& a) throw();
+
+#include <memory>
+#include <cassert>
+
+#include "../A.h"
+
+void
+test()
+{
+ {
+ A* p = new A(1);
+ const std::auto_ptr<A> ap1(p);
+ std::auto_ptr<A> ap2(ap1);
+ assert(ap1.get() == 0);
+ assert(ap2.get() == p);
+ assert(A::count == 1);
+ }
+ assert(A::count == 0);
+}
+
+int main()
+{
+ test();
+}
diff --git a/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/copy.pass.cpp b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/copy.pass.cpp
new file mode 100644
index 00000000000..1a3212265b2
--- /dev/null
+++ b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/copy.pass.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class X> class auto_ptr;
+
+// auto_ptr(auto_ptr& a) throw();
+
+#include <memory>
+#include <cassert>
+
+#include "../A.h"
+
+void
+test()
+{
+ {
+ A* p = new A(1);
+ std::auto_ptr<A> ap1(p);
+ std::auto_ptr<A> ap2(ap1);
+ assert(ap1.get() == 0);
+ assert(ap2.get() == p);
+ assert(A::count == 1);
+ }
+ assert(A::count == 0);
+}
+
+int main()
+{
+ test();
+}
diff --git a/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/explicit.fail.cpp b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/explicit.fail.cpp
new file mode 100644
index 00000000000..0e02e9b9789
--- /dev/null
+++ b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/explicit.fail.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class X> class auto_ptr;
+
+// explicit auto_ptr(X* p =0) throw();
+
+#include <memory>
+#include <cassert>
+
+#include "../A.h"
+
+void
+test()
+{
+ {
+ A* p = new A(1);
+ std::auto_ptr<A> ap = p;
+ assert(ap.get() == p);
+ assert(A::count == 1);
+ }
+ assert(A::count == 0);
+ {
+ std::auto_ptr<A> ap;
+ assert(ap.get() == 0);
+ }
+}
+
+int main()
+{
+ test();
+}
diff --git a/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/pointer.pass.cpp b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/pointer.pass.cpp
new file mode 100644
index 00000000000..5fe45dbf0c3
--- /dev/null
+++ b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/pointer.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class X> class auto_ptr;
+
+// explicit auto_ptr(X* p =0) throw();
+
+#include <memory>
+#include <cassert>
+
+#include "../A.h"
+
+void
+test()
+{
+ {
+ A* p = new A(1);
+ std::auto_ptr<A> ap(p);
+ assert(ap.get() == p);
+ assert(A::count == 1);
+ }
+ assert(A::count == 0);
+ {
+ std::auto_ptr<A> ap;
+ assert(ap.get() == 0);
+ }
+}
+
+int main()
+{
+ test();
+}
diff --git a/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/assign_from_auto_ptr_ref.pass.cpp b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/assign_from_auto_ptr_ref.pass.cpp
new file mode 100644
index 00000000000..70638699d83
--- /dev/null
+++ b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/assign_from_auto_ptr_ref.pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class X> class auto_ptr;
+
+// auto_ptr& operator=(auto_ptr_ref<X> r) throw()
+
+#include <memory>
+#include <cassert>
+
+#include "../A.h"
+
+void
+test()
+{
+ {
+ A* p1 = new A(1);
+ std::auto_ptr<A> ap1(p1);
+ std::auto_ptr_ref<A> apr = ap1;
+ std::auto_ptr<A> ap2(new A(2));
+ ap2 = apr;
+ assert(A::count == 1);
+ assert(ap2.get() == p1);
+ assert(ap1.get() == 0);
+ }
+ assert(A::count == 0);
+}
+
+int main()
+{
+ test();
+}
diff --git a/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_from_auto_ptr_ref.pass.cpp b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_from_auto_ptr_ref.pass.cpp
new file mode 100644
index 00000000000..9ca69c206e7
--- /dev/null
+++ b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_from_auto_ptr_ref.pass.cpp
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class X> class auto_ptr;
+
+// auto_ptr(auto_ptr_ref<X> r) throw();
+
+#include <memory>
+#include <cassert>
+
+#include "../AB.h"
+
+void
+test()
+{
+ {
+ B* p1 = new B(1);
+ std::auto_ptr<B> ap1(p1);
+ std::auto_ptr_ref<A> apr = ap1;
+ std::auto_ptr<A> ap2(apr);
+ assert(ap2.get() == p1);
+ assert(ap1.get() == 0);
+ }
+ assert(A::count == 0);
+ assert(B::count == 0);
+}
+
+int main()
+{
+ test();
+}
diff --git a/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr.pass.cpp b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr.pass.cpp
new file mode 100644
index 00000000000..629cb2b9e5a
--- /dev/null
+++ b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class X> class auto_ptr;
+
+// template<class Y> operator auto_ptr<Y>() throw();
+
+#include <memory>
+#include <cassert>
+
+#include "../AB.h"
+
+std::auto_ptr<B>
+source()
+{
+ return std::auto_ptr<B>(new B(1));
+}
+
+void
+test()
+{
+ std::auto_ptr<A> ap2(source());
+}
+
+int main()
+{
+ test();
+}
diff --git a/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr_ref.pass.cpp b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr_ref.pass.cpp
new file mode 100644
index 00000000000..bc434e3e16e
--- /dev/null
+++ b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr_ref.pass.cpp
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class X> class auto_ptr;
+
+// template<class Y> operator auto_ptr_ref<Y>() throw();
+
+#include <memory>
+#include <cassert>
+
+#include "../AB.h"
+
+void
+test()
+{
+ B* p1 = new B(1);
+ std::auto_ptr<B> ap1(p1);
+ std::auto_ptr_ref<A> apr = ap1;
+ delete p1;
+}
+
+int main()
+{
+ test();
+}
diff --git a/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/arrow.pass.cpp b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/arrow.pass.cpp
new file mode 100644
index 00000000000..48822ed62ce
--- /dev/null
+++ b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/arrow.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class X> class auto_ptr;
+
+// X& operator*() const throw();
+
+#include <memory>
+#include <cassert>
+
+#include "../A.h"
+
+void
+test()
+{
+ {
+ A* p = new A(1);
+ std::auto_ptr<A> ap(p);
+ assert(ap->id() == 1);
+ *ap = A(3);
+ assert(ap->id() == 3);
+ }
+ assert(A::count == 0);
+}
+
+int main()
+{
+ test();
+}
diff --git a/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/deref.pass.cpp b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/deref.pass.cpp
new file mode 100644
index 00000000000..5b3323d02d6
--- /dev/null
+++ b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/deref.pass.cpp
@@ -0,0 +1,37 @@
+//===----------------------------------------------------------------------===//
+//
+// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class X> class auto_ptr;
+
+// X& operator*() const throw();
+
+#include <memory>
+#include <cassert>
+
+#include "../A.h"
+
+void
+test()
+{
+ {
+ A* p = new A(1);
+ const std::auto_ptr<A> ap(p);
+ assert((*ap).id() == 1);
+ *ap = A(3);
+ assert((*ap).id() == 3);
+ }
+ assert(A::count == 0);
+}
+
+int main()
+{
+ test();
+}
diff --git a/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/release.pass.cpp b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/release.pass.cpp
new file mode 100644
index 00000000000..f282b1b8b53
--- /dev/null
+++ b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/release.pass.cpp
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class X> class auto_ptr;
+
+// X* release() throw();
+
+#include <memory>
+#include <cassert>
+
+#include "../A.h"
+
+void
+test()
+{
+ {
+ A* p = new A(1);
+ std::auto_ptr<A> ap(p);
+ A* p2 = ap.release();
+ assert(p2 == p);
+ assert(ap.get() == 0);
+ delete p;
+ }
+ assert(A::count == 0);
+}
+
+int main()
+{
+ test();
+}
diff --git a/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/reset.pass.cpp b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/reset.pass.cpp
new file mode 100644
index 00000000000..49cd55a8e51
--- /dev/null
+++ b/libcxx/test/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/reset.pass.cpp
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class X> class auto_ptr;
+
+// void reset(X* p=0) throw();
+
+#include <memory>
+#include <cassert>
+
+#include "../A.h"
+
+void
+test()
+{
+ {
+ A* p = new A(1);
+ std::auto_ptr<A> ap(p);
+ ap.reset();
+ assert(ap.get() == 0);
+ assert(A::count == 0);
+ }
+ assert(A::count == 0);
+ {
+ A* p = new A(1);
+ std::auto_ptr<A> ap(p);
+ ap.reset(p);
+ assert(ap.get() == p);
+ assert(A::count == 1);
+ }
+ assert(A::count == 0);
+ {
+ A* p = new A(1);
+ std::auto_ptr<A> ap(p);
+ A* p2 = new A(2);
+ ap.reset(p2);
+ assert(ap.get() == p2);
+ assert(A::count == 1);
+ }
+ assert(A::count == 0);
+}
+
+int main()
+{
+ test();
+}
diff --git a/libcxx/test/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp b/libcxx/test/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp
new file mode 100644
index 00000000000..79bd8f35c66
--- /dev/null
+++ b/libcxx/test/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <memory>
+
+// template <class X>
+// class auto_ptr
+// {
+// public:
+// typedef X element_type;
+// ...
+// };
+
+#include <memory>
+#include <type_traits>
+
+template <class T>
+void
+test()
+{
+ static_assert((std::is_same<typename std::auto_ptr<T>::element_type, T>::value), "");
+}
+
+int main()
+{
+ test<int>();
+ test<double>();
+ test<void>();
+ std::auto_ptr<void> p;
+}
diff --git a/libcxx/test/depr/depr.auto.ptr/nothing_to_do.pass.cpp b/libcxx/test/depr/depr.auto.ptr/nothing_to_do.pass.cpp
new file mode 100644
index 00000000000..fa4d462f18d
--- /dev/null
+++ b/libcxx/test/depr/depr.auto.ptr/nothing_to_do.pass.cpp
@@ -0,0 +1,12 @@
+//===----------------------------------------------------------------------===//
+//
+// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
OpenPOWER on IntegriCloud