bad_weak_ptr.pass.cpp revision b64f8b07c104c6cc986570ac8ee0ed16a9f23976
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// <memory>
11
12// class bad_weak_ptr
13//     : public std::exception
14// {
15// public:
16//     bad_weak_ptr();
17// };
18
19#include <memory>
20#include <type_traits>
21#include <cassert>
22#include <cstring>
23
24int main()
25{
26    static_assert((std::is_base_of<std::exception, std::bad_weak_ptr>::value), "");
27    std::bad_weak_ptr e;
28    std::bad_weak_ptr e2 = e;
29    e2 = e;
30    assert(std::strcmp(e.what(), "bad_weak_ptr") == 0);
31}
32