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

source code of libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.weakptr/bad_weak_ptr.pass.cpp