| //===----------------------------------------------------------------------===// |
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| // See https://llvm.org/LICENSE.txt for license information. |
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| //===----------------------------------------------------------------------===// |
| // template<class Y> explicit shared_ptr(const weak_ptr<Y>& r); |
| #ifndef TEST_HAS_NO_EXCEPTIONS |
| std::shared_ptr<A> sp(wp); |
| catch (std::bad_weak_ptr&) |
| std::shared_ptr<A> sp0(new A); |
| std::weak_ptr<A> wp(sp0); |
| std::shared_ptr<A> sp(wp); |
| assert(sp.use_count() == 2); |
| assert(sp.get() == sp0.get()); |
| #ifndef TEST_HAS_NO_EXCEPTIONS |
| std::shared_ptr<A> sp0(new A); |
| std::weak_ptr<A> wp(sp0); |
| std::shared_ptr<A> sp(wp); |
| catch (std::bad_weak_ptr&) |