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
24std::auto_ptr<B>
25source()
26{
27 return std::auto_ptr<B>(new B(1));
28}
29
30void
31test()
32{
33 std::auto_ptr<A> ap2(source());
34}
35
36int main(int, char**)
37{
38 test();
39
40 return 0;
41}
42

source code of libcxx/test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr.pass.cpp