]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/18_support/type_info/hash_code.cc
1 // { dg-options "-std=gnu++11" }
3 // 2010-09-21 Paolo Carlini <paolo.carlini@oracle.com>
5 // Copyright (C) 2010-2016 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>
27 bool test
__attribute__((unused
)) = true;
33 typedef const Abraca cAbraca
;
39 const type_info
& to01
= typeid(int);
40 const type_info
& to02
= typeid(double);
41 VERIFY( to01
!= to02
);
42 VERIFY( to01
.hash_code() != to02
.hash_code() );
44 const type_info
& to03
= typeid(a1
);
45 const type_info
& to04
= typeid(a2
);
46 VERIFY( to03
== to04
);
47 VERIFY( to03
.hash_code() == to04
.hash_code() );
49 const type_info
& to05
= typeid(Abraca
);
50 const type_info
& to06
= typeid(cAbraca
);
51 VERIFY( to05
== to06
);
52 VERIFY( to05
.hash_code() == to06
.hash_code() );
54 const type_info
& to07
= typeid(Abraca
);
55 const type_info
& to08
= typeid(a2
);
56 VERIFY( to07
== to08
);
57 VERIFY( to07
.hash_code() == to08
.hash_code() );
59 const type_info
& to09
= typeid(Abraca
);
60 const type_info
& to10
= typeid(const Abraca
&);
61 VERIFY( to09
== to10
);
62 VERIFY( to09
.hash_code() == to10
.hash_code() );
64 const type_info
& to11
= typeid(Abraca
);
65 const type_info
& to12
= typeid(Dabra
);
66 VERIFY( to11
!= to12
);
67 VERIFY( to11
.hash_code() != to12
.hash_code() );
69 const type_info
& to13
= typeid(a1
);
70 const type_info
& to14
= typeid(d1
);
71 VERIFY( to13
!= to14
);
72 VERIFY( to13
.hash_code() != to14
.hash_code() );