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 // template <class T, class D>
14 // bool operator==(const unique_ptr<T, D>& x, nullptr_t) noexcept;
15 // template <class T, class D>
16 // bool operator==(nullptr_t, const unique_ptr<T, D>& y) noexcept;
17 // template <class T, class D>
18 // bool operator!=(const unique_ptr<T, D>& x, nullptr_t) noexcept;
19 // template <class T, class D>
20 // bool operator!=(nullptr_t, const unique_ptr<T, D>& y) noexcept;
21 // template <class T, class D>
22 // bool operator<(const unique_ptr<T, D>& x, nullptr_t) noexcept;
23 // template <class T, class D>
24 // bool operator<(nullptr_t, const unique_ptr<T, D>& y) noexcept;
25 // template <class T, class D>
26 // bool operator<=(const unique_ptr<T, D>& x, nullptr_t) noexcept;
27 // template <class T, class D>
28 // bool operator<=(nullptr_t, const unique_ptr<T, D>& y) noexcept;
29 // template <class T, class D>
30 // bool operator>(const unique_ptr<T, D>& x, nullptr_t) noexcept;
31 // template <class T, class D>
32 // bool operator>(nullptr_t, const unique_ptr<T, D>& y) noexcept;
33 // template <class T, class D>
34 // bool operator>=(const unique_ptr<T, D>& x, nullptr_t) noexcept;
35 // template <class T, class D>
36 // bool operator>=(nullptr_t, const unique_ptr<T, D>& y) noexcept;
37
38 #include <memory>
39 #include <cassert>
40
41 #include "test_macros.h"
42
do_nothing(int *)43 void do_nothing(int*) {}
44
main(int,char **)45 int main(int, char**)
46 {
47 const std::unique_ptr<int> p1(new int(1));
48 assert(!(p1 == nullptr));
49 assert(!(nullptr == p1));
50 assert(!(p1 < nullptr));
51 assert( (nullptr < p1));
52 assert(!(p1 <= nullptr));
53 assert( (nullptr <= p1));
54 assert( (p1 > nullptr));
55 assert(!(nullptr > p1));
56 assert( (p1 >= nullptr));
57 assert(!(nullptr >= p1));
58
59 const std::unique_ptr<int> p2;
60 assert( (p2 == nullptr));
61 assert( (nullptr == p2));
62 assert(!(p2 < nullptr));
63 assert(!(nullptr < p2));
64 assert( (p2 <= nullptr));
65 assert( (nullptr <= p2));
66 assert(!(p2 > nullptr));
67 assert(!(nullptr > p2));
68 assert( (p2 >= nullptr));
69 assert( (nullptr >= p2));
70
71 return 0;
72 }
73