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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gdb-7.2/] [gdb-7.2-or32-1.0rc3/] [gdb/] [testsuite/] [gdb.cp/] [m-static.cc] - Blame information for rev 330

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
// 2002-05-13
2
 
3
enum region { oriental, egyptian, greek, etruscan, roman };
4
 
5
// Test one.
6
class gnu_obj_1
7
{
8
protected:
9
  typedef region antiquities;
10
  static const bool     test = true;
11
  static const int      key1 = 5;
12
  static long           key2;
13
 
14
  static antiquities    value;
15
 
16
public:
17
  gnu_obj_1(antiquities a, long l) {}
18
 
19
  long method ()
20
  {
21
    static bool svar = true;
22
    return key2;
23
  }
24
};
25
 
26
const bool gnu_obj_1::test;
27
const int gnu_obj_1::key1;
28
long gnu_obj_1::key2 = 77;
29
gnu_obj_1::antiquities gnu_obj_1::value = oriental;
30
 
31
 
32
// Test two.
33
template<typename T>
34
class gnu_obj_2: public virtual gnu_obj_1
35
{
36
public:
37
  static antiquities    value_derived;
38
 
39
public:
40
  gnu_obj_2(antiquities b): gnu_obj_1(oriental, 7) { }
41
};
42
 
43
template<typename T>
44
typename gnu_obj_2<T>::antiquities gnu_obj_2<T>::value_derived = etruscan;
45
 
46
// Test three.
47
template<typename T>
48
class gnu_obj_3
49
{
50
public:
51
  typedef region antiquities;
52
  static gnu_obj_2<int> data;
53
 
54
public:
55
  gnu_obj_3(antiquities b) { }
56
};
57
 
58
template<typename T>
59
gnu_obj_2<int> gnu_obj_3<T>::data(etruscan);
60
 
61
// 2002-08-16
62
// Test four.
63
#include "m-static.h"
64
 
65
// instantiate templates explicitly so their static members will exist
66
template class gnu_obj_2<int>;
67
template class gnu_obj_2<long>;
68
template class gnu_obj_3<long>;
69
 
70
int main()
71
{
72
  gnu_obj_1             test1(egyptian, 4589);
73
  gnu_obj_2<long>       test2(roman);
74
  gnu_obj_3<long>       test3(greek);
75
  gnu_obj_4             test4;
76
 
77
  test4.dummy = test4.elsewhere;
78
  test4.dummy = 0;
79
 
80
  test1.method (); // breakpoint: constructs-done
81
 
82
  return test4.dummy;
83
}

powered by: WebSVN 2.1.0

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