DebugCXX.h
2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/* -*- C++ -*- */
#include "dummy.h"
namespace DebugCXX {
// Records.
struct Struct {
int i;
static int static_member;
};
// Enums.
enum Enum {
Enumerator
};
enum {
e1 = '1'
};
enum {
e2 = '2'
};
// Templates (instantiations).
template<typename T> struct traits {};
template<typename T,
typename Traits = traits<T>
> class Template {
T member;
};
// Explicit template instantiation.
extern template class Template<int>;
extern template struct traits<float>;
typedef class Template<float> FloatInstantiation;
inline void fn() {
Template<long> invisible;
}
// Non-template inside a template.
template <class> struct Outer {
Outer();
struct Inner {
Inner(Outer) {}
};
};
template <class T> Outer<T>::Outer() {
Inner a(*this);
};
// Partial template specialization.
template <typename...> class A;
template <typename T> class A<T> {};
typedef A<void> B;
// Anchored by a function parameter.
void foo(B) {}
}
// Virtual class with a forward declaration.
struct Virtual;
struct Virtual {
virtual ~Virtual() {}
};
struct PureForwardDecl;
typedef union { int i; } TypedefUnion;
typedef enum { e0 = 0 } TypedefEnum;
typedef struct { int i; } TypedefStruct;
union { int i; } GlobalUnion;
struct { int i; } GlobalStruct;
enum { e5 = 5 } GlobalEnum;
namespace {
namespace {
struct InAnonymousNamespace { int i; };
}
}
class Base;
class A {
virtual Base *getParent() const;
};
class Base {};
class Derived : Base {
class B : A {
Derived *getParent() const override;
};
};
template <class T>
class Template1 {
T t;
};
typedef Template1<void *> TypedefTemplate;
extern template class Template1<int>;
template <class T> class FwdDeclTemplate;
typedef FwdDeclTemplate<int> TypedefFwdDeclTemplate;
// Member classes of class template specializations.
template <typename T> struct Specialized {};
template <> struct Specialized<int> {
struct Member;
};
template <class T> struct FwdDeclTemplateMember { struct Member; };
typedef FwdDeclTemplateMember<int>::Member TypedefFwdDeclTemplateMember;
// Base class specialized on the class itself.
template <typename Derived> class BaseTemplate {};
template <typename T>
class WithSpecializedBase : public BaseTemplate<WithSpecializedBase<T>> {};
typedef WithSpecializedBase<float> SpecializedBase;