1//===----------------------------------------------------------------------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// <memory>
11
12// template <class X> class auto_ptr;
13
14// auto_ptr(auto_ptr_ref<X> r) throw();
15
16#include <memory>
17#include <cassert>
18
19#include "../AB.h"
20
21void
22test()
23{
24    {
25    B* p1 = new B(1);
26    std::auto_ptr<B> ap1(p1);
27    std::auto_ptr_ref<A> apr = ap1;
28    std::auto_ptr<A> ap2(apr);
29    assert(ap2.get() == p1);
30    assert(ap1.get() == 0);
31    }
32    assert(A::count == 0);
33    assert(B::count == 0);
34}
35
36int main()
37{
38    test();
39}
40