| 1 |
/++ |
| 2 |
REQUIRED_ARGS: -HC -c -o- |
| 3 |
PERMUTE_ARGS: |
| 4 |
TEST_OUTPUT: |
| 5 |
--- |
| 6 |
// Automatically generated by Digital Mars D Compiler |
| 7 |
|
| 8 |
#pragma once |
| 9 |
|
| 10 |
#include <assert.h> |
| 11 |
#include <math.h> |
| 12 |
#include <stddef.h> |
| 13 |
#include <stdint.h> |
| 14 |
|
| 15 |
class ForwardClass; |
| 16 |
|
| 17 |
class BaseClass |
| 18 |
{ |
| 19 |
public: |
| 20 |
virtual void memberFun(ForwardClass* sds); |
| 21 |
}; |
| 22 |
|
| 23 |
class C |
| 24 |
{ |
| 25 |
public: |
| 26 |
int8_t a; |
| 27 |
int32_t b; |
| 28 |
int64_t c; |
| 29 |
}; |
| 30 |
|
| 31 |
class C2 |
| 32 |
{ |
| 33 |
public: |
| 34 |
int32_t a; |
| 35 |
int32_t b; |
| 36 |
int64_t c; |
| 37 |
C2(int32_t a); |
| 38 |
virtual const C* const constRet(); |
| 39 |
virtual void constPar(const C* const c); |
| 40 |
virtual void constThis() const; |
| 41 |
}; |
| 42 |
|
| 43 |
class Aligned |
| 44 |
{ |
| 45 |
public: |
| 46 |
int8_t a; |
| 47 |
int32_t b; |
| 48 |
int64_t c; |
| 49 |
Aligned(int32_t a); |
| 50 |
}; |
| 51 |
|
| 52 |
class A |
| 53 |
{ |
| 54 |
public: |
| 55 |
int32_t a; |
| 56 |
C* c; |
| 57 |
virtual void foo(); |
| 58 |
private: |
| 59 |
virtual void __vtable_slot_0(); |
| 60 |
public: |
| 61 |
virtual void baz(int32_t x = 42); |
| 62 |
struct |
| 63 |
{ |
| 64 |
int32_t x; |
| 65 |
int32_t y; |
| 66 |
}; |
| 67 |
union |
| 68 |
{ |
| 69 |
int32_t u1; |
| 70 |
char u2[4$?:32=u|64=LLU$]; |
| 71 |
}; |
| 72 |
struct Inner final |
| 73 |
{ |
| 74 |
int32_t x; |
| 75 |
Inner() : |
| 76 |
x() |
| 77 |
{ |
| 78 |
} |
| 79 |
Inner(int32_t x) : |
| 80 |
x(x) |
| 81 |
{} |
| 82 |
}; |
| 83 |
|
| 84 |
class InnerC |
| 85 |
{ |
| 86 |
public: |
| 87 |
int32_t x; |
| 88 |
}; |
| 89 |
|
| 90 |
class NonStaticInnerC |
| 91 |
{ |
| 92 |
public: |
| 93 |
int32_t x; |
| 94 |
A* outer; |
| 95 |
}; |
| 96 |
|
| 97 |
typedef Inner I; |
| 98 |
class CC; |
| 99 |
|
| 100 |
}; |
| 101 |
|
| 102 |
class I1 |
| 103 |
{ |
| 104 |
public: |
| 105 |
virtual void foo() = 0; |
| 106 |
}; |
| 107 |
|
| 108 |
class I2 : public I1 |
| 109 |
{ |
| 110 |
public: |
| 111 |
virtual void bar() = 0; |
| 112 |
}; |
| 113 |
|
| 114 |
class B : public A, public I1, public I2 |
| 115 |
{ |
| 116 |
public: |
| 117 |
using A::bar; |
| 118 |
void foo() final override; |
| 119 |
void bar() override; |
| 120 |
}; |
| 121 |
|
| 122 |
class Parent |
| 123 |
{ |
| 124 |
virtual void __vtable_slot_1(); |
| 125 |
virtual void __vtable_slot_2(); |
| 126 |
public: |
| 127 |
virtual void foo(); |
| 128 |
}; |
| 129 |
|
| 130 |
class Child final : public Parent |
| 131 |
{ |
| 132 |
public: |
| 133 |
void foo() override; |
| 134 |
}; |
| 135 |
|
| 136 |
class VisitorBase |
| 137 |
{ |
| 138 |
public: |
| 139 |
virtual void vir(); |
| 140 |
void stat(); |
| 141 |
}; |
| 142 |
|
| 143 |
class VisitorInter : public VisitorBase |
| 144 |
{ |
| 145 |
public: |
| 146 |
using VisitorBase::vir; |
| 147 |
virtual void vir(int32_t i); |
| 148 |
using VisitorBase::stat; |
| 149 |
void stat(int32_t i); |
| 150 |
}; |
| 151 |
|
| 152 |
class Visitor : public VisitorInter |
| 153 |
{ |
| 154 |
public: |
| 155 |
using VisitorInter::vir; |
| 156 |
using VisitorInter::stat; |
| 157 |
virtual void vir(bool b); |
| 158 |
virtual void vir(char d); |
| 159 |
}; |
| 160 |
|
| 161 |
class ForwardClass : public BaseClass |
| 162 |
{ |
| 163 |
}; |
| 164 |
--- |
| 165 |
+/ |
| 166 |
|
| 167 |
/* |
| 168 |
ClassDeclaration has the following issues: |
| 169 |
* align(n) does nothing. You can use align on classes in C++, though It is generally regarded as bad practice and should be avoided |
| 170 |
*/ |
| 171 |
|
| 172 |
extern (C++) class C |
| 173 |
{ |
| 174 |
byte a; |
| 175 |
int b; |
| 176 |
long c; |
| 177 |
} |
| 178 |
|
| 179 |
extern (C++) class C2 |
| 180 |
{ |
| 181 |
int a = 42; |
| 182 |
int b; |
| 183 |
long c; |
| 184 |
|
| 185 |
this(int a) {} |
| 186 |
|
| 187 |
const(C) constRet() { return null; } |
| 188 |
void constPar(const C c) {} |
| 189 |
void constThis() const {} |
| 190 |
} |
| 191 |
|
| 192 |
extern (C) class C3 |
| 193 |
{ |
| 194 |
int a = 42; |
| 195 |
int b; |
| 196 |
long c; |
| 197 |
|
| 198 |
this(int a) {} |
| 199 |
} |
| 200 |
|
| 201 |
extern (C++) align(1) class Aligned |
| 202 |
{ |
| 203 |
byte a; |
| 204 |
int b; |
| 205 |
long c; |
| 206 |
|
| 207 |
this(int a) {} |
| 208 |
} |
| 209 |
|
| 210 |
extern (C++) class A |
| 211 |
{ |
| 212 |
int a; |
| 213 |
C c; |
| 214 |
|
| 215 |
void foo(); |
| 216 |
extern (C) void bar() {} |
| 217 |
extern (C++) void baz(int x = 42) {} |
| 218 |
|
| 219 |
struct |
| 220 |
{ |
| 221 |
int x; |
| 222 |
int y; |
| 223 |
} |
| 224 |
|
| 225 |
union |
| 226 |
{ |
| 227 |
int u1; |
| 228 |
char[4] u2; |
| 229 |
} |
| 230 |
|
| 231 |
struct Inner |
| 232 |
{ |
| 233 |
int x; |
| 234 |
} |
| 235 |
|
| 236 |
static extern(C++) class InnerC |
| 237 |
{ |
| 238 |
int x; |
| 239 |
} |
| 240 |
|
| 241 |
class NonStaticInnerC |
| 242 |
{ |
| 243 |
int x; |
| 244 |
} |
| 245 |
|
| 246 |
alias I = Inner; |
| 247 |
|
| 248 |
extern(C++) class CC; |
| 249 |
|
| 250 |
} |
| 251 |
|
| 252 |
extern(C++): |
| 253 |
interface I1 |
| 254 |
{ |
| 255 |
void foo(); |
| 256 |
} |
| 257 |
interface I2 : I1 |
| 258 |
{ |
| 259 |
void bar(); |
| 260 |
} |
| 261 |
|
| 262 |
class B : A, I1, I2 |
| 263 |
{ |
| 264 |
alias bar = A.bar; |
| 265 |
override final void foo() {} |
| 266 |
override void bar() {} |
| 267 |
} |
| 268 |
|
| 269 |
class Parent |
| 270 |
{ |
| 271 |
extern(D) void over() {} |
| 272 |
extern(D) void over(int) {} |
| 273 |
void foo() {} |
| 274 |
} |
| 275 |
|
| 276 |
final class Child : Parent |
| 277 |
{ |
| 278 |
extern(D) override void over() {} |
| 279 |
override void foo() {} |
| 280 |
} |
| 281 |
|
| 282 |
class VisitorBase |
| 283 |
{ |
| 284 |
void vir() {} |
| 285 |
|
| 286 |
final void stat() {} |
| 287 |
} |
| 288 |
|
| 289 |
class VisitorInter : VisitorBase |
| 290 |
{ |
| 291 |
alias vir = VisitorBase.vir; |
| 292 |
void vir(int i) {} |
| 293 |
|
| 294 |
alias stat = VisitorBase.stat; |
| 295 |
final void stat(int i) {} |
| 296 |
} |
| 297 |
|
| 298 |
class Visitor : VisitorInter |
| 299 |
{ |
| 300 |
alias vir = VisitorInter.vir; |
| 301 |
|
| 302 |
alias stat = VisitorInter.stat; |
| 303 |
|
| 304 |
mixin Methods!() m; |
| 305 |
alias vir = m.vir; |
| 306 |
} |
| 307 |
|
| 308 |
mixin template Methods() |
| 309 |
{ |
| 310 |
extern(C++) void vir(bool b) {} |
| 311 |
|
| 312 |
extern(C++) void vir(char d) {} |
| 313 |
} |
| 314 |
|
| 315 |
class ForwardClass : BaseClass |
| 316 |
{ |
| 317 |
} |
| 318 |
|
| 319 |
class BaseClass |
| 320 |
{ |
| 321 |
void memberFun(ForwardClass sds); |
| 322 |
} |