| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/nestedtempl2.d(22): Deprecation: function `nestedtempl2.B.func!(n).func` function requires a dual-context, which is deprecated |
| 5 |
fail_compilation/nestedtempl2.d(34): instantiated from here: `func!(n)` |
| 6 |
fail_compilation/nestedtempl2.d(34): Error: `this` is only defined in non-static member functions, not `test` |
| 7 |
fail_compilation/nestedtempl2.d(34): Error: need `this` of type `B` to call function `func` |
| 8 |
fail_compilation/nestedtempl2.d(35): Error: `this` is only defined in non-static member functions, not `test` |
| 9 |
fail_compilation/nestedtempl2.d(35): Error: need `this` of type `B` to make delegate from function `func` |
| 10 |
fail_compilation/nestedtempl2.d(37): Error: `this` is only defined in non-static member functions, not `test` |
| 11 |
fail_compilation/nestedtempl2.d(37): Error: need `this` of type `B` needed to `new` nested class `N` |
| 12 |
--- |
| 13 |
*/ |
| 14 |
|
| 15 |
class B |
| 16 |
{ |
| 17 |
int n; |
| 18 |
} |
| 19 |
|
| 20 |
void test() |
| 21 |
{ |
| 22 |
auto func(alias a)() |
| 23 |
{ |
| 24 |
return a; |
| 25 |
} |
| 26 |
|
| 27 |
class N(alias a) |
| 28 |
{ |
| 29 |
} |
| 30 |
|
| 31 |
auto b = new B(); |
| 32 |
b.n = 1; |
| 33 |
|
| 34 |
func!(b.n)(); |
| 35 |
auto dg = &func!(b.n); |
| 36 |
|
| 37 |
new N!(b.n)(); |
| 38 |
} |