xref: /llvm-project/libcxx/test/std/utilities/memory/default.allocator/allocator.globals/eq.pass.cpp (revision 0724f8bf47f8cb073d41e2750d45d5b05e66bf0b)
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 // allocator:
12 
13 // template <class T1, class T2>
14 //   constexpr bool
15 //   operator==(const allocator<T1>&, const allocator<T2>&) throw();
16 //
17 // template <class T1, class T2>
18 //   constexpr bool
19 //   operator!=(const allocator<T1>&, const allocator<T2>&) throw();
20 
21 #include <memory>
22 #include <cassert>
23 
24 #include "test_macros.h"
25 
test()26 TEST_CONSTEXPR_CXX20 bool test()
27 {
28     std::allocator<int> a1;
29     std::allocator<int> a2;
30     assert(a1 == a2);
31     assert(!(a1 != a2));
32 
33     return true;
34 }
35 
main(int,char **)36 int main(int, char**)
37 {
38     test();
39 
40 #if TEST_STD_VER > 17
41     static_assert(test());
42 #endif
43 
44     return 0;
45 }
46