]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/18_support/type_info/hash_code.cc
1 // { dg-do run { target c++11 } }
3 // 2010-09-21 Paolo Carlini <paolo.carlini@oracle.com>
5 // Copyright (C) 2010-2019 Free Software Foundation, Inc.
7 // This file is part of the GNU ISO C++ Library. This library is free
8 // software; you can redistribute it and/or modify it under the
9 // terms of the GNU General Public License as published by the
10 // Free Software Foundation; either version 3, or (at your option)
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License along
19 // with this library; see the file COPYING3. If not see
20 // <http://www.gnu.org/licenses/>.
23 #include <testsuite_hooks.h>
32 typedef const Abraca cAbraca
;
38 const type_info
& to01
= typeid(int);
39 const type_info
& to02
= typeid(double);
40 VERIFY( to01
!= to02
);
41 VERIFY( to01
.hash_code() != to02
.hash_code() );
43 const type_info
& to03
= typeid(a1
);
44 const type_info
& to04
= typeid(a2
);
45 VERIFY( to03
== to04
);
46 VERIFY( to03
.hash_code() == to04
.hash_code() );
48 const type_info
& to05
= typeid(Abraca
);
49 const type_info
& to06
= typeid(cAbraca
);
50 VERIFY( to05
== to06
);
51 VERIFY( to05
.hash_code() == to06
.hash_code() );
53 const type_info
& to07
= typeid(Abraca
);
54 const type_info
& to08
= typeid(a2
);
55 VERIFY( to07
== to08
);
56 VERIFY( to07
.hash_code() == to08
.hash_code() );
58 const type_info
& to09
= typeid(Abraca
);
59 const type_info
& to10
= typeid(const Abraca
&);
60 VERIFY( to09
== to10
);
61 VERIFY( to09
.hash_code() == to10
.hash_code() );
63 const type_info
& to11
= typeid(Abraca
);
64 const type_info
& to12
= typeid(Dabra
);
65 VERIFY( to11
!= to12
);
66 VERIFY( to11
.hash_code() != to12
.hash_code() );
68 const type_info
& to13
= typeid(a1
);
69 const type_info
& to14
= typeid(d1
);
70 VERIFY( to13
!= to14
);
71 VERIFY( to13
.hash_code() != to14
.hash_code() );