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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.old-deja/] [g++.abi/] [ptrflags.C] - Blame information for rev 699

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 699 jeremybenn
// { dg-do run  }
2
// Test rtti pointer flags
3
// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
4
// Contributed by Nathan Sidwell 15 Apr 2000 
5
 
6
#include 
7
 
8
#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
9
#include 
10
 
11
struct A {int m;};
12
struct B;
13
 
14
using namespace abi;
15
 
16
int expect (int flags, std::type_info const &info)
17
{
18
  abi::__pbase_type_info const *ptr =
19
      dynamic_cast  (&info);
20
  if (!ptr)
21
    return 0;
22
  if (ptr->__flags != flags)
23
    return 0;
24
  return 1;
25
}
26
 
27
int main ()
28
{
29
  if (! expect (0, typeid (A *)))
30
    return 1;
31
  if (! expect (1, typeid (A const *)))
32
    return 2;
33
  if (! expect (2, typeid (A volatile *)))
34
    return 3;
35
  if (! expect (4, typeid (A *__restrict__ *)))
36
    return 4;
37
  if (! expect (0, typeid (int A::*)))
38
    return 5;
39
  if (! expect (0, typeid (int A::**)))
40
    return 6;
41
 
42
  if (! expect (8 | 0, typeid (B *)))
43
    return 11;
44
  if (! expect (8 | 1, typeid (B const *)))
45
    return 12;
46
  if (! expect (8 | 2, typeid (B volatile *)))
47
    return 13;
48
  if (! expect (8 | 4, typeid (B *__restrict__ *)))
49
    return 14;
50
  if (! expect (16 | 0, typeid (int B::*)))
51
    return 15;
52
  if (! expect (8 | 0, typeid (int B::**)))
53
    return 16;
54
  if (! expect (8 | 0, typeid (B A::*)))
55
    return 17;
56
  if (! expect (24, typeid (B B::*)))
57
    return 18;
58
 
59
  return 0;
60
}
61
 
62
#else
63
int main ()
64
{
65
  return 0;
66
}
67
#endif

powered by: WebSVN 2.1.0

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