| 1 |
// PERMUTE_ARGS: |
| 2 |
|
| 3 |
template AddField(T) |
| 4 |
{ |
| 5 |
T b; |
| 6 |
this(Args...)(T b, auto ref Args args) |
| 7 |
{ |
| 8 |
this.b = b; |
| 9 |
this(args); |
| 10 |
} |
| 11 |
} |
| 12 |
|
| 13 |
template construcotrs() |
| 14 |
{ |
| 15 |
int a; |
| 16 |
this(int a) |
| 17 |
{ |
| 18 |
this.a = a; |
| 19 |
} |
| 20 |
} |
| 21 |
|
| 22 |
class B |
| 23 |
{ |
| 24 |
mixin construcotrs; |
| 25 |
mixin AddField!(string); |
| 26 |
} |
| 27 |
|
| 28 |
class C : B |
| 29 |
{ |
| 30 |
this(A...)(A args) |
| 31 |
{ |
| 32 |
// The called super ctor is an overload set. |
| 33 |
super(args); |
| 34 |
} |
| 35 |
} |
| 36 |
|
| 37 |
struct S |
| 38 |
{ |
| 39 |
mixin construcotrs; |
| 40 |
mixin AddField!(string); |
| 41 |
} |
| 42 |
|
| 43 |
void main() |
| 44 |
{ |
| 45 |
auto s = S("bar", 15); |
| 46 |
auto c = new C("bar", 15); |
| 47 |
} |