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// test type_info
10
11// UNSUPPORTED: no-rtti
12
13#include <typeinfo>
14#include <cstring>
15#include <cassert>
16
17#include "test_macros.h"
18
19int main(int, char**)
20{
21 const std::type_info& t1 = typeid(int);
22 const std::type_info& t2 = typeid(int);
23 const std::type_info& t3 = typeid(short);
24 assert(t1.hash_code() == t2.hash_code());
25 assert(t1.hash_code() != t3.hash_code());
26
27 return 0;
28}
29

source code of libcxx/test/std/language.support/support.rtti/type.info/type_info_hash.pass.cpp