Home | History | Annotate | Download | only in bad.typeid
      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_typeid
     11 
     12 #include <typeinfo>
     13 #include <type_traits>
     14 #include <cassert>
     15 
     16 int main()
     17 {
     18     static_assert((std::is_base_of<std::exception, std::bad_typeid>::value),
     19                  "std::is_base_of<std::exception, std::bad_typeid>::value");
     20     static_assert(std::is_polymorphic<std::bad_typeid>::value,
     21                  "std::is_polymorphic<std::bad_typeid>::value");
     22     std::bad_typeid b;
     23     std::bad_typeid b2 = b;
     24     b2 = b;
     25     const char* w = b2.what();
     26     assert(w);
     27 }
     28