xref: /llvm-project/libcxx/test/std/language.support/support.exception/propagation/exception_ptr.pass.cpp (revision 9ddcc55228e3ca1763bf743b81f8809edbe0e487)
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // exception_ptr has not been implemented on Windows
11 // XFAIL: LIBCXX-WINDOWS-FIXME
12 
13 // <exception>
14 
15 // typedef unspecified exception_ptr;
16 
17 // exception_ptr shall satisfy the requirements of NullablePointer.
18 
19 #include <exception>
20 #include <cassert>
21 
22 int main()
23 {
24     std::exception_ptr p;
25     assert(p == nullptr);
26     std::exception_ptr p2 = p;
27     assert(nullptr == p);
28     assert(!p);
29     assert(p2 == p);
30     p2 = p;
31     assert(p2 == p);
32     assert(p2 == nullptr);
33     std::exception_ptr p3 = nullptr;
34     assert(p3 == nullptr);
35     p3 = nullptr;
36     assert(p3 == nullptr);
37 }
38