bad_typeid.pass.cpp revision f5256e16dfc425c1d466f6308d4026d529ce9e0b
1//===----------------------------------------------------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10// test bad_typeid 11 12#include <typeinfo> 13#include <type_traits> 14#include <cassert> 15 16int 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