xref: /llvm-project/libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr.pass.cpp (revision 61f2b3ed2183d24252561f9b48007e6cde937ce4)
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <memory>
10 
11 // template <class X> class auto_ptr;
12 
13 // template<class Y> operator auto_ptr<Y>() throw();
14 
15 // REQUIRES: c++03 || c++11 || c++14
16 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
17 
18 #include <memory>
19 #include <cassert>
20 
21 #include "test_macros.h"
22 #include "../AB.h"
23 
24 std::auto_ptr<B>
source()25 source()
26 {
27     return std::auto_ptr<B>(new B(1));
28 }
29 
30 void
test()31 test()
32 {
33     std::auto_ptr<A> ap2(source());
34 }
35 
main(int,char **)36 int main(int, char**)
37 {
38     test();
39 
40   return 0;
41 }
42