1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
13 // bool expired() const;
18 #include "test_macros.h"
25 A(const A
&) {++count
;}
35 assert(wp
.use_count() == 0);
36 assert(wp
.expired() == (wp
.use_count() == 0));
39 std::shared_ptr
<A
> sp0(new A
);
40 std::weak_ptr
<A
> wp(sp0
);
41 assert(wp
.use_count() == 1);
42 assert(wp
.expired() == (wp
.use_count() == 0));
44 assert(wp
.use_count() == 0);
45 assert(wp
.expired() == (wp
.use_count() == 0));