| 1 |
// PERMUTE_ARGS: |
| 2 |
// EXTRA_FILES: imports/fwdref9514.d imports/fwdref12201a.d |
| 3 |
|
| 4 |
/***************************************************/ |
| 5 |
// https://issues.dlang.org/show_bug.cgi?id=6766 |
| 6 |
|
| 7 |
class Foo6766 |
| 8 |
{ |
| 9 |
this(int x) { } |
| 10 |
void test(Foo6766 foo = new Foo6766(1)) { } |
| 11 |
} |
| 12 |
|
| 13 |
struct Bar6766 |
| 14 |
{ |
| 15 |
this(int x) { } |
| 16 |
void test(Bar6766 bar = Bar6766(1)) { } |
| 17 |
} |
| 18 |
|
| 19 |
/***************************************************/ |
| 20 |
// https://issues.dlang.org/show_bug.cgi?id=8609 |
| 21 |
|
| 22 |
struct Tuple8609(T) |
| 23 |
{ |
| 24 |
T arg; |
| 25 |
} |
| 26 |
|
| 27 |
// ---- |
| 28 |
|
| 29 |
struct Foo8609a |
| 30 |
{ |
| 31 |
Bar8609a b; |
| 32 |
} |
| 33 |
struct Bar8609a |
| 34 |
{ |
| 35 |
int x; |
| 36 |
Tuple8609!(Foo8609a) spam() { return Tuple8609!(Foo8609a)(); } |
| 37 |
} |
| 38 |
|
| 39 |
// ---- |
| 40 |
|
| 41 |
struct Foo8609b |
| 42 |
{ |
| 43 |
Bar8609b b; |
| 44 |
} |
| 45 |
struct Bar8609b |
| 46 |
{ |
| 47 |
int x; |
| 48 |
Tuple8609!(Foo8609b[1]) spam() { return Tuple8609!(Foo8609b[1])(); } |
| 49 |
} |
| 50 |
|
| 51 |
/***************************************************/ |
| 52 |
// https://issues.dlang.org/show_bug.cgi?id=8698 |
| 53 |
|
| 54 |
interface IRoot8698a {} |
| 55 |
interface IClass8698a : IRoot8698a { } |
| 56 |
struct Struct8698a { } |
| 57 |
class Class8698a : IClass8698a { alias Struct8698a Value; } |
| 58 |
void test8698a(Class8698a.Value) { } |
| 59 |
//interface IRoot8698a {} |
| 60 |
|
| 61 |
// ---- |
| 62 |
|
| 63 |
//interface IRoot8698b {} |
| 64 |
interface IClass8698b : IRoot8698b { } |
| 65 |
struct Struct8698b { } |
| 66 |
class Class8698b : IClass8698b { alias Struct8698b Value; } |
| 67 |
void test8698b(Class8698b.Value) { } |
| 68 |
interface IRoot8698b {} |
| 69 |
|
| 70 |
/***************************************************/ |
| 71 |
// https://issues.dlang.org/show_bug.cgi?id=9514 |
| 72 |
|
| 73 |
template TStructHelpers9514a() |
| 74 |
{ |
| 75 |
void opEquals(Foo9514a) |
| 76 |
{ |
| 77 |
auto n = FieldNames9514a!(); |
| 78 |
} |
| 79 |
} |
| 80 |
|
| 81 |
struct Foo9514a |
| 82 |
{ |
| 83 |
mixin TStructHelpers9514a!(); |
| 84 |
} |
| 85 |
|
| 86 |
import imports.fwdref9514 : find9514; // selective import without aliasing |
| 87 |
|
| 88 |
template FieldNames9514a() |
| 89 |
{ |
| 90 |
static if (find9514!`true`([1])) enum int FieldNames9514a = 1; |
| 91 |
} |
| 92 |
|
| 93 |
// ---- |
| 94 |
|
| 95 |
template TStructHelpers9514b() |
| 96 |
{ |
| 97 |
void opEquals(Foo9514b) |
| 98 |
{ |
| 99 |
auto n = FieldNames9514b!(); |
| 100 |
} |
| 101 |
} |
| 102 |
|
| 103 |
struct Foo9514b |
| 104 |
{ |
| 105 |
mixin TStructHelpers9514b!(); |
| 106 |
} |
| 107 |
|
| 108 |
import imports.fwdref9514 : foo9514 = find9514; // selective import with aliasing |
| 109 |
|
| 110 |
template FieldNames9514b() |
| 111 |
{ |
| 112 |
static if (foo9514!`true`([1])) enum int FieldNames9514b = 1; |
| 113 |
} |
| 114 |
|
| 115 |
/***************************************************/ |
| 116 |
// https://issues.dlang.org/show_bug.cgi?id=10015 |
| 117 |
|
| 118 |
struct S10015(T) { alias X = int; } |
| 119 |
|
| 120 |
alias Y10015 = s10015.X; |
| 121 |
S10015!int s10015; |
| 122 |
|
| 123 |
/***************************************************/ |
| 124 |
// https://issues.dlang.org/show_bug.cgi?id=10101 |
| 125 |
|
| 126 |
int front10101(int); |
| 127 |
|
| 128 |
mixin template reflectRange10101() |
| 129 |
{ |
| 130 |
static if (is(typeof(this.front10101))) |
| 131 |
{ |
| 132 |
int x; |
| 133 |
} |
| 134 |
} |
| 135 |
|
| 136 |
struct S10101(R) |
| 137 |
{ |
| 138 |
R r_; |
| 139 |
|
| 140 |
typeof(r_.front10101) front10101() @property { return r_.front10101; } |
| 141 |
|
| 142 |
mixin reflectRange10101; |
| 143 |
} |
| 144 |
|
| 145 |
void test10101() |
| 146 |
{ |
| 147 |
S10101!(int) s; |
| 148 |
} |
| 149 |
|
| 150 |
/***************************************************/ |
| 151 |
// https://issues.dlang.org/show_bug.cgi?id=11019 |
| 152 |
|
| 153 |
class A11019 |
| 154 |
{ |
| 155 |
A11019 View() { return null; } |
| 156 |
} |
| 157 |
|
| 158 |
class B11019 : A11019 |
| 159 |
{ |
| 160 |
override D11019 View() { return null; } |
| 161 |
} |
| 162 |
|
| 163 |
class D11019 : B11019 {} |
| 164 |
|
| 165 |
/***************************************************/ |
| 166 |
// https://issues.dlang.org/show_bug.cgi?id=11166 |
| 167 |
|
| 168 |
template Tup11166(T...) { alias Tup11166 = T; } |
| 169 |
|
| 170 |
struct S11166a |
| 171 |
{ |
| 172 |
enum S11166a a = S11166a(0); |
| 173 |
enum S11166a b = S11166a(1); |
| 174 |
|
| 175 |
this(long value) { } |
| 176 |
|
| 177 |
long value; |
| 178 |
|
| 179 |
// only triggered when private and a template instance. |
| 180 |
private alias types = Tup11166!(a, b); |
| 181 |
} |
| 182 |
|
| 183 |
struct S11166b |
| 184 |
{ |
| 185 |
enum S11166b a = S11166b(0); |
| 186 |
enum S11166b b = S11166b(1); |
| 187 |
|
| 188 |
// not at the last of members |
| 189 |
alias types = Tup11166!(a, b); |
| 190 |
|
| 191 |
this(long value) { } |
| 192 |
|
| 193 |
long value; |
| 194 |
} |
| 195 |
|
| 196 |
/***************************************************/ |
| 197 |
// https://issues.dlang.org/show_bug.cgi?id=12152 |
| 198 |
|
| 199 |
class A12152 |
| 200 |
{ |
| 201 |
alias Y = B12152.X; |
| 202 |
} |
| 203 |
|
| 204 |
class B12152 : A12152 |
| 205 |
{ |
| 206 |
alias int X; |
| 207 |
} |
| 208 |
|
| 209 |
static assert(is(A12152.Y == int)); |
| 210 |
|
| 211 |
/***************************************************/ |
| 212 |
// https://issues.dlang.org/show_bug.cgi?id=12201 |
| 213 |
|
| 214 |
template T12201() |
| 215 |
{ |
| 216 |
alias imports.fwdref12201a.FILE* FP; |
| 217 |
} |
| 218 |
|
| 219 |
struct S12201a |
| 220 |
{ |
| 221 |
mixin T12201; |
| 222 |
import imports.fwdref12201a; |
| 223 |
} |
| 224 |
|
| 225 |
union U12201 |
| 226 |
{ |
| 227 |
mixin T12201; |
| 228 |
import imports.fwdref12201a; |
| 229 |
} |
| 230 |
|
| 231 |
class C12201 |
| 232 |
{ |
| 233 |
mixin T12201; |
| 234 |
import imports.fwdref12201a; |
| 235 |
} |
| 236 |
|
| 237 |
interface I12201 |
| 238 |
{ |
| 239 |
mixin T12201; |
| 240 |
import imports.fwdref12201a; |
| 241 |
} |
| 242 |
|
| 243 |
|
| 244 |
template TI12201() |
| 245 |
{ |
| 246 |
mixin T12201; |
| 247 |
import imports.fwdref12201a; |
| 248 |
} |
| 249 |
mixin template TM12201() |
| 250 |
{ |
| 251 |
mixin T12201; |
| 252 |
import imports.fwdref12201a; |
| 253 |
} |
| 254 |
struct S12201b |
| 255 |
{ |
| 256 |
alias ti = TI12201!(); |
| 257 |
|
| 258 |
mixin TM12201; |
| 259 |
} |
| 260 |
|
| 261 |
/***************************************************/ |
| 262 |
// https://issues.dlang.org/show_bug.cgi?id=12531 |
| 263 |
|
| 264 |
struct Node12531(T) |
| 265 |
{ |
| 266 |
T _val; |
| 267 |
} |
| 268 |
|
| 269 |
void test12531() |
| 270 |
{ |
| 271 |
static struct Foo |
| 272 |
{ |
| 273 |
Node12531!Foo* node; |
| 274 |
} |
| 275 |
} |
| 276 |
|
| 277 |
/***************************************************/ |
| 278 |
// https://issues.dlang.org/show_bug.cgi?id=12543 |
| 279 |
|
| 280 |
class C12543; |
| 281 |
static assert(C12543.sizeof == (void*).sizeof); |
| 282 |
static assert(C12543.alignof == (void*).sizeof); |
| 283 |
static assert(C12543.mangleof == "C10testfwdref6C12543"); |
| 284 |
|
| 285 |
/***************************************************/ |
| 286 |
// https://issues.dlang.org/show_bug.cgi?id=14010 |
| 287 |
|
| 288 |
enum E14010; |
| 289 |
static assert(E14010.mangleof == "E10testfwdref6E14010"); |
| 290 |
|
| 291 |
struct S14010; |
| 292 |
static assert(S14010.mangleof == "S10testfwdref6S14010"); |
| 293 |
|
| 294 |
/***************************************************/ |
| 295 |
// https://issues.dlang.org/show_bug.cgi?id=12983 |
| 296 |
|
| 297 |
alias I12983 = int; |
| 298 |
class B12983(T) { alias MyC = C12983!string; } |
| 299 |
|
| 300 |
class C12983(T) : B12983!float |
| 301 |
{ |
| 302 |
void m() { f12983(0); } |
| 303 |
} |
| 304 |
|
| 305 |
alias MyB12983 = B12983!float; |
| 306 |
|
| 307 |
void f12983(); |
| 308 |
void f12983(I12983); |
| 309 |
|
| 310 |
/***************************************************/ |
| 311 |
// https://issues.dlang.org/show_bug.cgi?id=12984 |
| 312 |
|
| 313 |
class B12984a { alias MyD = D12984a!int; } |
| 314 |
class C12984a : B12984a { } |
| 315 |
|
| 316 |
class D12984a(T) { alias MyE = E12984a!float; } |
| 317 |
class E12984a(T) : D12984a!int |
| 318 |
{ |
| 319 |
void m() |
| 320 |
{ |
| 321 |
auto c = new C12984a(); |
| 322 |
} |
| 323 |
} |
| 324 |
|
| 325 |
static assert(__traits(classInstanceSize, B12984a) == (void*).sizeof * 2); |
| 326 |
static assert(__traits(classInstanceSize, C12984a) == (void*).sizeof * 2); |
| 327 |
|
| 328 |
// ---- |
| 329 |
|
| 330 |
class B12984b { int b; alias MyD = D12984b!int; } |
| 331 |
class C12984b : B12984b { int c; } |
| 332 |
|
| 333 |
class D12984b(T) { int d; alias MyE = E12984b!float; } |
| 334 |
class E12984b(T) : D12984b!int |
| 335 |
{ |
| 336 |
int e; |
| 337 |
void m() |
| 338 |
{ |
| 339 |
auto c = new C12984b(); |
| 340 |
} |
| 341 |
} |
| 342 |
|
| 343 |
static assert(__traits(classInstanceSize, B12984b) == (void*).sizeof * 2 + int.sizeof); |
| 344 |
static assert(__traits(classInstanceSize, C12984b) == (void*).sizeof * 2 + int.sizeof * 2); |
| 345 |
|
| 346 |
/***************************************************/ |
| 347 |
// https://issues.dlang.org/show_bug.cgi?id=14390 |
| 348 |
|
| 349 |
class B14390a { alias MyD = D14390a!int; } |
| 350 |
class C14390a : B14390a { void f(int) {} } |
| 351 |
class D14390a(T) { alias MyE = E14390a!float; } |
| 352 |
class E14390a(T) : D14390a!int { void m() { auto c = new C14390a(); } } |
| 353 |
|
| 354 |
class B14390b { alias MyD = D14390b!int; } |
| 355 |
class C14390b : B14390b { static struct S {} } |
| 356 |
class D14390b(T) { alias MyE = E14390b!float; } |
| 357 |
class E14390b(T) : D14390b!int { void m() { auto c = new C14390b(); } } |
| 358 |
|
| 359 |
/***************************************************/ |
| 360 |
// https://issues.dlang.org/show_bug.cgi?id=13860 |
| 361 |
|
| 362 |
/* |
| 363 |
TEST_OUTPUT: |
| 364 |
--- |
| 365 |
pure nothrow @nogc @safe void() |
| 366 |
pure nothrow @nogc @safe void() |
| 367 |
--- |
| 368 |
*/ |
| 369 |
|
| 370 |
struct Foo13860(Bar...) |
| 371 |
{ |
| 372 |
Bar bars; |
| 373 |
auto baz(size_t d)() {} |
| 374 |
pragma(msg, typeof(baz!0)); |
| 375 |
} |
| 376 |
|
| 377 |
auto bar13860(S, R)(S s, R r) |
| 378 |
{ |
| 379 |
pragma(msg, typeof(Foo13860!().baz!0)); |
| 380 |
} |
| 381 |
|
| 382 |
void test13860() |
| 383 |
{ |
| 384 |
int[] x; |
| 385 |
int[] y; |
| 386 |
x.bar13860(y); |
| 387 |
} |
| 388 |
|
| 389 |
/***************************************************/ |
| 390 |
// https://issues.dlang.org/show_bug.cgi?id=14083 |
| 391 |
|
| 392 |
class NBase14083 |
| 393 |
{ |
| 394 |
int foo(NA14083 a) { return 1; } |
| 395 |
int foo(NB14083 a) { return 2; } |
| 396 |
} |
| 397 |
class NA14083 : NBase14083 |
| 398 |
{ |
| 399 |
int v; |
| 400 |
this(int v) { this.v = v; } |
| 401 |
} |
| 402 |
class NB14083 : NBase14083 |
| 403 |
{ |
| 404 |
override int foo(NA14083 a) { return a.v; } |
| 405 |
} |
| 406 |
|
| 407 |
class TBase14083(T) |
| 408 |
{ |
| 409 |
int foo(TA14083!T a) { return 1; } |
| 410 |
int foo(TB14083!T a) { return 2; } |
| 411 |
} |
| 412 |
class TA14083(T) : TBase14083!T |
| 413 |
{ |
| 414 |
T v; |
| 415 |
this(T v) { this.v = v; } |
| 416 |
} |
| 417 |
class TB14083(T) : TBase14083!T |
| 418 |
{ |
| 419 |
override int foo(TA14083!T a) { return a.v; } |
| 420 |
} |
| 421 |
|
| 422 |
static assert( |
| 423 |
{ |
| 424 |
NA14083 na = new NA14083(10); |
| 425 |
NB14083 nb = new NB14083(); |
| 426 |
assert(na.foo(na) == 1); |
| 427 |
assert(na.foo(nb) == 2); |
| 428 |
assert(nb.foo(na) == 10); |
| 429 |
|
| 430 |
TA14083!int ta = new TA14083!int(10); |
| 431 |
TB14083!int tb = new TB14083!int(); |
| 432 |
assert(ta.foo(ta) == 1); |
| 433 |
assert(ta.foo(tb) == 2); |
| 434 |
assert(tb.foo(ta) == 10); |
| 435 |
|
| 436 |
return true; |
| 437 |
}()); |
| 438 |
|
| 439 |
/***************************************************/ |
| 440 |
// https://issues.dlang.org/show_bug.cgi?id=14549 |
| 441 |
|
| 442 |
string foo14549(T)() |
| 443 |
{ |
| 444 |
static if (T.tupleof.length >= 0) |
| 445 |
return ""; |
| 446 |
} |
| 447 |
|
| 448 |
class Frop14549 |
| 449 |
{ |
| 450 |
mixin(foo14549!(typeof(this))); |
| 451 |
|
| 452 |
static if (__traits(compiles, undefined)) |
| 453 |
{ |
| 454 |
} |
| 455 |
else |
| 456 |
{ |
| 457 |
int bar = 0; |
| 458 |
} |
| 459 |
|
| 460 |
static if (!__traits(isVirtualMethod, this.bar)) {} |
| 461 |
} |
| 462 |
|
| 463 |
// ---- |
| 464 |
// regression case |
| 465 |
|
| 466 |
template Mix14549() |
| 467 |
{ |
| 468 |
mixin(code14549!(typeof(this))); |
| 469 |
} |
| 470 |
|
| 471 |
template code14549(T) |
| 472 |
{ |
| 473 |
enum string code14549 = |
| 474 |
q{ static if (!__traits(isVirtualMethod, "boo")) {} }; |
| 475 |
} |
| 476 |
|
| 477 |
class Bar14549 |
| 478 |
{ |
| 479 |
mixin Mix14549; |
| 480 |
int boo; |
| 481 |
} |
| 482 |
|
| 483 |
// ---- |
| 484 |
// https://issues.dlang.org/show_bug.cgi?id=14609 |
| 485 |
// regression case |
| 486 |
|
| 487 |
interface Foo14609(T) |
| 488 |
{ |
| 489 |
static if (is(T == int)) |
| 490 |
public int bar(); |
| 491 |
} |
| 492 |
class Frop14609 : Foo14609!int |
| 493 |
{ |
| 494 |
public int bar() { return 0; } |
| 495 |
} |
| 496 |
|
| 497 |
/***************************************************/ |
| 498 |
// test case 1, comes from Phobos |
| 499 |
/* |
| 500 |
TEST_OUTPUT: |
| 501 |
--- |
| 502 |
+alias Alias12540 |
| 503 |
+anySatisfy, T.length == 1 |
| 504 |
+isStaticArray |
| 505 |
+T.stringof in StaticArrayTypeOf |
| 506 |
-T.stringof in StaticArrayTypeOf |
| 507 |
-isStaticArray |
| 508 |
+hasElaborateCpCtor S == struct or else |
| 509 |
-hasElaborateCpCtor S == struct or else |
| 510 |
-anySatisfy, T.length == 1 |
| 511 |
-alias Alias12540 |
| 512 |
--- |
| 513 |
*/ |
| 514 |
|
| 515 |
template anySatisfy15726x(alias F, T...) |
| 516 |
{ |
| 517 |
//static if (T.length == 1) |
| 518 |
//{ |
| 519 |
pragma(msg, "+anySatisfy, T.length == 1"); |
| 520 |
enum anySatisfy15726x = F!(T[0]); |
| 521 |
pragma(msg, "-anySatisfy, T.length == 1"); |
| 522 |
//} |
| 523 |
} |
| 524 |
|
| 525 |
template StaticArrayTypeOf15726x(T) |
| 526 |
{ |
| 527 |
alias X = T; |
| 528 |
|
| 529 |
static if (is(X : E[n], E, size_t n)) |
| 530 |
{ |
| 531 |
//alias StaticArrayTypeOf15726x = X; |
| 532 |
} |
| 533 |
else |
| 534 |
{ |
| 535 |
pragma(msg, "+T.stringof in StaticArrayTypeOf"); |
| 536 |
// Fixed: T.stringof (T == Class12540) should not invoke |
| 537 |
// T.size() in ClassDeclaration.search(). |
| 538 |
static assert(0, T.stringof~" is not a static array type"); |
| 539 |
pragma(msg, "-T.stringof in StaticArrayTypeOf"); |
| 540 |
} |
| 541 |
} |
| 542 |
|
| 543 |
//enum bool isStaticArray(T) = is(StaticArrayTypeOf15726x!T); |
| 544 |
template isStaticArray15726x(T) |
| 545 |
{ |
| 546 |
pragma(msg, "+isStaticArray"); |
| 547 |
enum bool isStaticArray15726x = is(StaticArrayTypeOf15726x!T); |
| 548 |
pragma(msg, "-isStaticArray"); |
| 549 |
} |
| 550 |
|
| 551 |
template hasElaborateCpCtor15726x(S) |
| 552 |
{ |
| 553 |
static if (isStaticArray15726x!S && S.length) |
| 554 |
{ |
| 555 |
//pragma(msg, "X+"); |
| 556 |
enum bool hasElaborateCpCtor15726x = |
| 557 |
hasElaborateCpCtor15726x!(typeof(S.init[0])); |
| 558 |
//pragma(msg, "X-"); |
| 559 |
} |
| 560 |
else |
| 561 |
{ |
| 562 |
pragma(msg, "+hasElaborateCpCtor S == struct or else"); |
| 563 |
static if (is(S == struct)) |
| 564 |
{ |
| 565 |
enum bool hasElaborateCpCtor15726x = true; |
| 566 |
//enum hasElaborateCpCtor15726x = hasMember!(S, "__postblit") |
| 567 |
// || anySatisfy15726x!(.hasElaborateCpCtor15726x, FieldTypeTuple!S); |
| 568 |
} |
| 569 |
else |
| 570 |
{ |
| 571 |
enum bool hasElaborateCpCtor15726x = false; |
| 572 |
} |
| 573 |
pragma(msg, "-hasElaborateCpCtor S == struct or else"); |
| 574 |
} |
| 575 |
} |
| 576 |
|
| 577 |
struct VariantN15726x(AllowedTypesParam...) |
| 578 |
{ |
| 579 |
alias AllowedTypes = AllowedTypesParam; |
| 580 |
|
| 581 |
static if (!AllowedTypes.length || |
| 582 |
anySatisfy15726x!(hasElaborateCpCtor15726x, AllowedTypes)) |
| 583 |
{ |
| 584 |
} |
| 585 |
} |
| 586 |
|
| 587 |
template Algebraic15726x(T) |
| 588 |
{ |
| 589 |
alias Algebraic15726x = VariantN15726x!(T); |
| 590 |
} |
| 591 |
|
| 592 |
void test15726x() |
| 593 |
{ |
| 594 |
static struct DummyScope |
| 595 |
{ |
| 596 |
pragma(msg, "+alias Alias12540"); |
| 597 |
alias Alias12540 = Algebraic15726x!Class12540; |
| 598 |
pragma(msg, "-alias Alias12540"); |
| 599 |
static class Class12540 |
| 600 |
{ |
| 601 |
Alias12540 entity; |
| 602 |
} |
| 603 |
} |
| 604 |
} |
| 605 |
|
| 606 |
/***************************************************/ |
| 607 |
// test case 2, comes from Phobos |
| 608 |
|
| 609 |
struct RefCounted15726y(T) |
| 610 |
{ |
| 611 |
struct RefCountedStore |
| 612 |
{ |
| 613 |
struct Impl |
| 614 |
{ |
| 615 |
T _payload; |
| 616 |
} |
| 617 |
Impl* _store; |
| 618 |
} |
| 619 |
RefCountedStore _refCounted; |
| 620 |
|
| 621 |
this(this) {} |
| 622 |
|
| 623 |
~this() |
| 624 |
{ |
| 625 |
_refCounted._store._payload.__xdtor(); |
| 626 |
} |
| 627 |
} |
| 628 |
|
| 629 |
struct RangeT15726y(A) |
| 630 |
{ |
| 631 |
A[1] _outer_; |
| 632 |
alias RC = RangeT15726y!(const(A)); |
| 633 |
} |
| 634 |
|
| 635 |
struct Array15726y(T) |
| 636 |
{ |
| 637 |
struct Payload |
| 638 |
{ |
| 639 |
~this(); |
| 640 |
} |
| 641 |
|
| 642 |
alias Data = RefCounted15726y!(Payload); |
| 643 |
Data _data; |
| 644 |
|
| 645 |
alias Range = RangeT15726y!Array15726y; |
| 646 |
} |
| 647 |
|
| 648 |
void test15726y() |
| 649 |
{ |
| 650 |
alias Range = RangeT15726y!(Array15726y!int); |
| 651 |
Range r; |
| 652 |
r = r; // opAssign |
| 653 |
} |
| 654 |
|
| 655 |
/***************************************************/ |
| 656 |
// https://issues.dlang.org/show_bug.cgi?id=15726 |
| 657 |
|
| 658 |
struct RC15726(T) |
| 659 |
{ |
| 660 |
struct Impl |
| 661 |
{ |
| 662 |
T _payload; |
| 663 |
} |
| 664 |
|
| 665 |
Impl* _store; |
| 666 |
|
| 667 |
~this() |
| 668 |
{ |
| 669 |
destroy15726a(_store._payload); |
| 670 |
} |
| 671 |
} |
| 672 |
|
| 673 |
// ---- |
| 674 |
|
| 675 |
struct Con15726a(T) |
| 676 |
{ |
| 677 |
alias Stmt15726a = .Stmt15726a!T; |
| 678 |
} |
| 679 |
|
| 680 |
struct Stmt15726a(T) |
| 681 |
{ |
| 682 |
alias Con15726a = .Con15726a!T; |
| 683 |
|
| 684 |
RC15726!Payload data; |
| 685 |
|
| 686 |
struct Payload |
| 687 |
{ |
| 688 |
Con15726a con; |
| 689 |
} |
| 690 |
} |
| 691 |
|
| 692 |
Con15726a!int x15726a; |
| 693 |
|
| 694 |
void destroy15726a(T)(ref T obj) @trusted |
| 695 |
{ |
| 696 |
auto buf = (cast(ubyte*)&obj)[0 .. T.sizeof]; |
| 697 |
} |
| 698 |
|
| 699 |
// ---- |
| 700 |
|
| 701 |
struct Util15726b(C, S) {} |
| 702 |
|
| 703 |
struct Con15726b(T) |
| 704 |
{ |
| 705 |
alias Util15726b = .Util15726b!(Con15726b!T, Stmt15726b!T); |
| 706 |
} |
| 707 |
|
| 708 |
struct Stmt15726b(T) |
| 709 |
{ |
| 710 |
struct Payload |
| 711 |
{ |
| 712 |
Con15726b!T con; |
| 713 |
} |
| 714 |
|
| 715 |
RC15726!Payload data; |
| 716 |
} |
| 717 |
|
| 718 |
Con15726b!int x15726b; |