• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 // test bad_cast
11 
12 #include <typeinfo>
13 #include <type_traits>
14 #include <cassert>
15 
main()16 int main()
17 {
18     static_assert((std::is_base_of<std::exception, std::bad_cast>::value),
19                  "std::is_base_of<std::exception, std::bad_cast>::value");
20     static_assert(std::is_polymorphic<std::bad_cast>::value,
21                  "std::is_polymorphic<std::bad_cast>::value");
22     std::bad_cast b;
23     std::bad_cast b2 = b;
24     b2 = b;
25     const char* w = b2.what();
26     assert(w);
27 }
28