| 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 |
struct S1 final |
| 17 |
{ |
| 18 |
int32_t a; |
| 19 |
protected: |
| 20 |
int32_t b; |
| 21 |
int32_t c; |
| 22 |
int32_t d; |
| 23 |
private: |
| 24 |
int32_t e; |
| 25 |
public: |
| 26 |
S1() : |
| 27 |
a(), |
| 28 |
b(), |
| 29 |
c(), |
| 30 |
d(), |
| 31 |
e() |
| 32 |
{ |
| 33 |
} |
| 34 |
S1(int32_t a, int32_t b = 0, int32_t c = 0, int32_t d = 0, int32_t e = 0) : |
| 35 |
a(a), |
| 36 |
b(b), |
| 37 |
c(c), |
| 38 |
d(d), |
| 39 |
e(e) |
| 40 |
{} |
| 41 |
}; |
| 42 |
|
| 43 |
class S2 final |
| 44 |
{ |
| 45 |
public: |
| 46 |
int32_t af(); |
| 47 |
protected: |
| 48 |
int32_t bf(); |
| 49 |
int32_t cf(); |
| 50 |
int32_t df(); |
| 51 |
public: |
| 52 |
S2() |
| 53 |
{ |
| 54 |
} |
| 55 |
}; |
| 56 |
|
| 57 |
class C1 |
| 58 |
{ |
| 59 |
public: |
| 60 |
int32_t a; |
| 61 |
protected: |
| 62 |
int32_t b; |
| 63 |
int32_t c; |
| 64 |
int32_t d; |
| 65 |
private: |
| 66 |
int32_t e; |
| 67 |
}; |
| 68 |
|
| 69 |
struct C2 |
| 70 |
{ |
| 71 |
virtual int32_t af(); |
| 72 |
protected: |
| 73 |
virtual int32_t bf(); |
| 74 |
int32_t cf(); |
| 75 |
int32_t df(); |
| 76 |
}; |
| 77 |
|
| 78 |
struct Outer final |
| 79 |
{ |
| 80 |
private: |
| 81 |
int32_t privateOuter; |
| 82 |
public: |
| 83 |
struct PublicInnerStruct final |
| 84 |
{ |
| 85 |
private: |
| 86 |
int32_t privateInner; |
| 87 |
public: |
| 88 |
int32_t publicInner; |
| 89 |
PublicInnerStruct() : |
| 90 |
privateInner(), |
| 91 |
publicInner() |
| 92 |
{ |
| 93 |
} |
| 94 |
PublicInnerStruct(int32_t privateInner, int32_t publicInner = 0) : |
| 95 |
privateInner(privateInner), |
| 96 |
publicInner(publicInner) |
| 97 |
{} |
| 98 |
}; |
| 99 |
|
| 100 |
private: |
| 101 |
struct PrivateInnerClass final |
| 102 |
{ |
| 103 |
private: |
| 104 |
int32_t privateInner; |
| 105 |
public: |
| 106 |
int32_t publicInner; |
| 107 |
PrivateInnerClass() : |
| 108 |
privateInner(), |
| 109 |
publicInner() |
| 110 |
{ |
| 111 |
} |
| 112 |
PrivateInnerClass(int32_t privateInner, int32_t publicInner = 0) : |
| 113 |
privateInner(privateInner), |
| 114 |
publicInner(publicInner) |
| 115 |
{} |
| 116 |
}; |
| 117 |
|
| 118 |
public: |
| 119 |
class PublicInnerInterface |
| 120 |
{ |
| 121 |
public: |
| 122 |
virtual void foo() = 0; |
| 123 |
}; |
| 124 |
|
| 125 |
private: |
| 126 |
enum class PrivateInnerEnum |
| 127 |
{ |
| 128 |
A = 0, |
| 129 |
B = 1, |
| 130 |
}; |
| 131 |
|
| 132 |
public: |
| 133 |
typedef PrivateInnerEnum PublicAlias; |
| 134 |
Outer() : |
| 135 |
privateOuter() |
| 136 |
{ |
| 137 |
} |
| 138 |
Outer(int32_t privateOuter) : |
| 139 |
privateOuter(privateOuter) |
| 140 |
{} |
| 141 |
}; |
| 142 |
--- |
| 143 |
*/ |
| 144 |
|
| 145 |
module compilable.dtoh_protection; |
| 146 |
|
| 147 |
extern(C++) struct S1 |
| 148 |
{ |
| 149 |
public int a; |
| 150 |
protected int b; |
| 151 |
package int c; |
| 152 |
package(compilable) int d; |
| 153 |
private int e; |
| 154 |
} |
| 155 |
|
| 156 |
extern(C++, class) struct S2 |
| 157 |
{ |
| 158 |
public int af(); |
| 159 |
protected int bf(); |
| 160 |
package int cf(); |
| 161 |
package(compilable) int df(); |
| 162 |
private int ef(); |
| 163 |
} |
| 164 |
|
| 165 |
extern(C++) class C1 |
| 166 |
{ |
| 167 |
public int a; |
| 168 |
protected int b; |
| 169 |
package int c; |
| 170 |
package(compilable) int d; |
| 171 |
private int e; |
| 172 |
} |
| 173 |
|
| 174 |
extern(C++, struct) class C2 |
| 175 |
{ |
| 176 |
public int af(); |
| 177 |
protected int bf(); |
| 178 |
package int cf(); |
| 179 |
package(compilable) int df(); |
| 180 |
private int ef(); |
| 181 |
} |
| 182 |
|
| 183 |
extern(C++) struct Outer |
| 184 |
{ |
| 185 |
private int privateOuter; |
| 186 |
|
| 187 |
static struct PublicInnerStruct |
| 188 |
{ |
| 189 |
private int privateInner; |
| 190 |
int publicInner; |
| 191 |
} |
| 192 |
|
| 193 |
private static struct PrivateInnerClass |
| 194 |
{ |
| 195 |
private int privateInner; |
| 196 |
int publicInner; |
| 197 |
} |
| 198 |
|
| 199 |
static interface PublicInnerInterface |
| 200 |
{ |
| 201 |
void foo(); |
| 202 |
} |
| 203 |
|
| 204 |
private static enum PrivateInnerEnum |
| 205 |
{ |
| 206 |
A, |
| 207 |
B |
| 208 |
} |
| 209 |
|
| 210 |
public alias PublicAlias = PrivateInnerEnum; |
| 211 |
} |