Debian Codegraph @

libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/default.pass.cpp

raw
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 // shared_ptr();
12
13 #include <memory>
14 #include <cassert>
15
16 #include "test_macros.h"
17
18 struct A {};
19
20 template <class T>
21 void test() {
22 std::shared_ptr<T> p;
23 assert(p.use_count() == 0);
24 assert(p.get() == 0);
25 }
26
27 int main(int, char**) {
28 test<int>();
29 test<int const>();
30 test<A>();
31 test<A const>();
32 test<int*>();
33 test<int const*>();
34 test<int[]>();
35 test<int[8]>();
36
37 return 0;
38 }