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