| 1 |
// https://issues.dlang.org/show_bug.cgi?id=7851 |
| 2 |
/* |
| 3 |
TEST_OUTPUT: |
| 4 |
--- |
| 5 |
fail_compilation/fail7851.d(38): Error: accessing non-static variable `__mem_field_0` requires an instance of `Tuple` |
| 6 |
fail_compilation/fail7851.d(38): Error: accessing non-static variable `__mem_field_1` requires an instance of `Tuple` |
| 7 |
fail_compilation/fail7851.d(38): Error: accessing non-static variable `__mem_field_2` requires an instance of `Tuple` |
| 8 |
--- |
| 9 |
*/ |
| 10 |
|
| 11 |
|
| 12 |
template TypeTuple(TList...) |
| 13 |
{ |
| 14 |
alias TList TypeTuple; |
| 15 |
} |
| 16 |
|
| 17 |
struct Tuple(Specs...) |
| 18 |
{ |
| 19 |
TypeTuple!(int, long, float) mem; |
| 20 |
|
| 21 |
alias Identity!(mem[0]) _0; |
| 22 |
alias Identity!(mem[1]) _1; |
| 23 |
alias Identity!(mem[2]) _2; |
| 24 |
|
| 25 |
alias mem this; |
| 26 |
|
| 27 |
enum length = mem.length; |
| 28 |
} |
| 29 |
|
| 30 |
private template Identity(alias T) |
| 31 |
{ |
| 32 |
alias T Identity; |
| 33 |
} |
| 34 |
|
| 35 |
|
| 36 |
void main() { |
| 37 |
alias Tuple!(int, long, float) TL; |
| 38 |
foreach (i; TL) |
| 39 |
{ } |
| 40 |
} |