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