OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gdb/] [gdb-6.8/] [gdb-6.8.openrisc-2.1/] [gdb/] [testsuite/] [gdb.cp/] [m-static.cc] - Blame information for rev 33

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 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
 
20
const bool gnu_obj_1::test;
21
const int gnu_obj_1::key1;
22
long gnu_obj_1::key2 = 77;
23
gnu_obj_1::antiquities gnu_obj_1::value = oriental;
24
 
25
 
26
// Test two.
27
template<typename T>
28
class gnu_obj_2: public virtual gnu_obj_1
29
{
30
public:
31
  static antiquities    value_derived;
32
 
33
public:
34
  gnu_obj_2(antiquities b): gnu_obj_1(oriental, 7) { }
35
};
36
 
37
template<typename T>
38
typename gnu_obj_2<T>::antiquities gnu_obj_2<T>::value_derived = etruscan;
39
 
40
// Test three.
41
template<typename T>
42
class gnu_obj_3
43
{
44
public:
45
  typedef region antiquities;
46
  static gnu_obj_2<int> data;
47
 
48
public:
49
  gnu_obj_3(antiquities b) { }
50
};
51
 
52
template<typename T>
53
gnu_obj_2<int> gnu_obj_3<T>::data(etruscan);
54
 
55
// 2002-08-16
56
// Test four.
57
#include "m-static.h"
58
 
59
// instantiate templates explicitly so their static members will exist
60
template class gnu_obj_2<int>;
61
template class gnu_obj_2<long>;
62
template class gnu_obj_3<long>;
63
 
64
int main()
65
{
66
  gnu_obj_1             test1(egyptian, 4589);
67
  gnu_obj_2<long>       test2(roman);
68
  gnu_obj_3<long>       test3(greek);
69
  gnu_obj_4             test4;
70
 
71
  test4.dummy = 0;
72
  return test4.dummy;   // breakpoint: constructs-done
73
}

powered by: WebSVN 2.1.0

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