OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-dev/] [fsf-gcc-snapshot-1-mar-12/] [or1k-gcc/] [libstdc++-v3/] [testsuite/] [18_support/] [type_info/] [hash_code.cc] - Blame information for rev 783

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 742 jeremybenn
// { dg-options "-std=gnu++0x" }
2
 
3
// 2010-09-21  Paolo Carlini  <paolo.carlini@oracle.com>
4
//
5
// Copyright (C) 2010 Free Software Foundation
6
//
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)
11
// any later version.
12
 
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.
17
 
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/>.
21
 
22
#include <typeinfo>
23
#include <testsuite_hooks.h>
24
 
25
void test01()
26
{
27
  bool test __attribute__((unused)) = true;
28
  using namespace std;
29
 
30
  class Abraca { };
31
  Abraca a1, a2_;
32
 
33
  typedef const Abraca cAbraca;
34
  cAbraca a2 = a2_;
35
 
36
  class Dabra { };
37
  Dabra d1;
38
 
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() );
43
 
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() );
48
 
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() );
53
 
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() );
58
 
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() );
63
 
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() );
68
 
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() );
73
}
74
 
75
int main()
76
{
77
  test01();
78
  return 0;
79
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.