1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
|
/*
RUN_OUTPUT:
---
Success
---
*/
extern(C) int printf(const char*, ...);
/******************************************/
// https://issues.dlang.org/show_bug.cgi?id=12078
class B12078(T)
{
static assert(is(T : B12078!T), "not related");
}
class D12078 : B12078!D12078
{
}
interface X12078(T)
{
static assert(is(T : X12078!T), "not related");
}
interface Y12078 : X12078!Y12078
{
}
void test12078()
{
static assert(is(D12078 : B12078!D12078));
static assert(is(Y12078 : X12078!Y12078));
}
/******************************************/
// https://issues.dlang.org/show_bug.cgi?id=12143
class Node12143
{
alias typeof(true ? Node12143.init : Class12143.init) V;
static assert(is(V == Node12143));
}
class Type12143 : Node12143 {}
class Class12143 : Type12143 {}
/***************************************************/
// https://issues.dlang.org/show_bug.cgi?id=13353
interface Base13353(T)
{
static assert(is(T : Base13353!T));
}
interface Derived13353 : Base13353!Derived13353
{
void func();
}
class Concrete13353 : Derived13353
{
void func() {}
}
/***************************************************/
// https://issues.dlang.org/show_bug.cgi?id=15733
class CStmt15733 : CNode15733 {}
class CDecl15733 : CStmt15733 {}
class CNode15733 { mixin CMix!CDecl15733; }
template CMix(T){ mixin("static " ~ T.stringof ~ " x;"); }
interface IStmt15733 : INode15733 {}
interface IDecl15733 : IStmt15733 {}
interface INode15733 { mixin IMix!IDecl15733; }
template IMix(T){ mixin("static " ~ T.stringof ~ " x;"); }
/***************************************************/
// https://issues.dlang.org/show_bug.zip?id=20716
extern(C++):
struct S20716
{
void* s;
~this() {}
// or this(this) {}
}
interface I20716
{
S20716 x();
}
final class C20716 : I20716
{
int l = 3;
S20716 x()
{
//printf("this = %p, %p\n", this, &this.l);
assert(l == 3); //fails
return S20716.init;
}
}
extern(D):
void test20716()
{
auto s = new C20716().x;
auto t = new C20716().I20716.x;
}
/***************************************************/
int main()
{
test20716();
printf("Success\n");
return 0;
}
|