]> gcc.gnu.org Git - gcc.git/blob - gcc/testsuite/gdc.test/compilable/dtoh_protection.d
Merge branch 'master' into devel/modula-2.
[gcc.git] / gcc / testsuite / gdc.test / compilable / dtoh_protection.d
1 /**
2 https://issues.dlang.org/show_bug.cgi?id=21218
3
4 REQUIRED_ARGS: -HC -o-
5 TEST_OUTPUT:
6 ---
7 // Automatically generated by Digital Mars D Compiler
8
9 #pragma once
10
11 #include <assert.h>
12 #include <math.h>
13 #include <stddef.h>
14 #include <stdint.h>
15
16 #ifdef CUSTOM_D_ARRAY_TYPE
17 #define _d_dynamicArray CUSTOM_D_ARRAY_TYPE
18 #else
19 /// Represents a D [] array
20 template<typename T>
21 struct _d_dynamicArray final
22 {
23 size_t length;
24 T *ptr;
25
26 _d_dynamicArray() : length(0), ptr(NULL) { }
27
28 _d_dynamicArray(size_t length_in, T *ptr_in)
29 : length(length_in), ptr(ptr_in) { }
30
31 T& operator[](const size_t idx) {
32 assert(idx < length);
33 return ptr[idx];
34 }
35
36 const T& operator[](const size_t idx) const {
37 assert(idx < length);
38 return ptr[idx];
39 }
40 };
41 #endif
42
43 struct S1 final
44 {
45 int32_t a;
46 protected:
47 int32_t b;
48 int32_t c;
49 int32_t d;
50 private:
51 int32_t e;
52 public:
53 S1() :
54 a(),
55 b(),
56 c(),
57 d(),
58 e()
59 {
60 }
61 S1(int32_t a, int32_t b = 0, int32_t c = 0, int32_t d = 0, int32_t e = 0) :
62 a(a),
63 b(b),
64 c(c),
65 d(d),
66 e(e)
67 {}
68 };
69
70 class S2 final
71 {
72 public:
73 int32_t af();
74 protected:
75 int32_t bf();
76 int32_t cf();
77 int32_t df();
78 public:
79 S2()
80 {
81 }
82 };
83
84 class C1
85 {
86 public:
87 int32_t a;
88 protected:
89 int32_t b;
90 int32_t c;
91 int32_t d;
92 private:
93 int32_t e;
94 };
95
96 struct C2
97 {
98 virtual int32_t af();
99 protected:
100 virtual int32_t bf();
101 int32_t cf();
102 int32_t df();
103 };
104
105 struct Outer final
106 {
107 private:
108 int32_t privateOuter;
109 public:
110 struct PublicInnerStruct final
111 {
112 private:
113 int32_t privateInner;
114 public:
115 int32_t publicInner;
116 PublicInnerStruct() :
117 privateInner(),
118 publicInner()
119 {
120 }
121 PublicInnerStruct(int32_t privateInner, int32_t publicInner = 0) :
122 privateInner(privateInner),
123 publicInner(publicInner)
124 {}
125 };
126
127 private:
128 struct PrivateInnerClass final
129 {
130 private:
131 int32_t privateInner;
132 public:
133 int32_t publicInner;
134 PrivateInnerClass() :
135 privateInner(),
136 publicInner()
137 {
138 }
139 PrivateInnerClass(int32_t privateInner, int32_t publicInner = 0) :
140 privateInner(privateInner),
141 publicInner(publicInner)
142 {}
143 };
144
145 public:
146 class PublicInnerInterface
147 {
148 public:
149 virtual void foo() = 0;
150 };
151
152 private:
153 enum class PrivateInnerEnum
154 {
155 A = 0,
156 B = 1,
157 };
158
159 public:
160 typedef PrivateInnerEnum PublicAlias;
161 Outer() :
162 privateOuter()
163 {
164 }
165 Outer(int32_t privateOuter) :
166 privateOuter(privateOuter)
167 {}
168 };
169 ---
170 */
171
172 module compilable.dtoh_protection;
173
174 extern(C++) struct S1
175 {
176 public int a;
177 protected int b;
178 package int c;
179 package(compilable) int d;
180 private int e;
181 }
182
183 extern(C++, class) struct S2
184 {
185 public int af();
186 protected int bf();
187 package int cf();
188 package(compilable) int df();
189 private int ef();
190 }
191
192 extern(C++) class C1
193 {
194 public int a;
195 protected int b;
196 package int c;
197 package(compilable) int d;
198 private int e;
199 }
200
201 extern(C++, struct) class C2
202 {
203 public int af();
204 protected int bf();
205 package int cf();
206 package(compilable) int df();
207 private int ef();
208 }
209
210 extern(C++) struct Outer
211 {
212 private int privateOuter;
213
214 static struct PublicInnerStruct
215 {
216 private int privateInner;
217 int publicInner;
218 }
219
220 private static struct PrivateInnerClass
221 {
222 private int privateInner;
223 int publicInner;
224 }
225
226 static interface PublicInnerInterface
227 {
228 void foo();
229 }
230
231 private static enum PrivateInnerEnum
232 {
233 A,
234 B
235 }
236
237 public alias PublicAlias = PrivateInnerEnum;
238 }
This page took 0.047545 seconds and 5 git commands to generate.