Home | History | Annotate | Download | only in auto.ptr.members
      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 // X& operator*() const throw();
     15 
     16 #include <memory>
     17 #include <cassert>
     18 
     19 #include "../A.h"
     20 
     21 void
     22 test()
     23 {
     24     {
     25     A* p = new A(1);
     26     std::auto_ptr<A> ap(p);
     27     assert(ap->id() == 1);
     28     *ap = A(3);
     29     assert(ap->id() == 3);
     30     }
     31     assert(A::count == 0);
     32 }
     33 
     34 int main()
     35 {
     36     test();
     37 }
     38