| 1 |
module imports.test40a; |
| 2 |
|
| 3 |
import core.stdc.stdio; |
| 4 |
|
| 5 |
template Mix() |
| 6 |
{ |
| 7 |
static void foobar() |
| 8 |
{ |
| 9 |
auto context = new Context; |
| 10 |
auto ts = context.toString; |
| 11 |
printf("context: %.*s %p\n", cast(int)ts.length, ts.ptr, context); |
| 12 |
context.func!(typeof(this))(); |
| 13 |
printf("returning from opCall\n"); |
| 14 |
} |
| 15 |
} |
| 16 |
|
| 17 |
|
| 18 |
class Bar |
| 19 |
{ |
| 20 |
mixin Mix; |
| 21 |
} |
| 22 |
|
| 23 |
|
| 24 |
void someFunc(string z) |
| 25 |
{ |
| 26 |
printf("str length: %zd\n", z.length); |
| 27 |
printf("str: '%.*s'\n", cast(int)z.length, z.ptr); |
| 28 |
} |
| 29 |
|
| 30 |
|
| 31 |
class Context |
| 32 |
{ |
| 33 |
void func(T)() |
| 34 |
{ |
| 35 |
printf("<context.func\n"); |
| 36 |
printf("thisptr: %p\n", this); |
| 37 |
someFunc(`a`); |
| 38 |
printf("context.func>\n"); |
| 39 |
} |
| 40 |
} |