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 type_info 11 12 #include <typeinfo> 13 #include <cstring> 14 #include <cassert> 15 main()16int main() 17 { 18 const std::type_info& t1 = typeid(int); 19 const std::type_info& t2 = typeid(int); 20 assert(t1 == t2); 21 const std::type_info& t3 = typeid(short); 22 assert(t1 != t3); 23 assert(!t1.before(t2)); 24 assert(strcmp(t1.name(), t2.name()) == 0); 25 assert(strcmp(t1.name(), t3.name()) != 0); 26 } 27