| 1 |
// REQUIRED_ARGS: |
| 2 |
|
| 3 |
/**********************************/ |
| 4 |
// https://issues.dlang.org/show_bug.cgi?id=19479 |
| 5 |
|
| 6 |
mixin template genInts19479a() |
| 7 |
{ |
| 8 |
static foreach (t; 0..1) |
| 9 |
int i = 5; |
| 10 |
} |
| 11 |
|
| 12 |
mixin template genInts19479b() |
| 13 |
{ |
| 14 |
static foreach (t; 0..2) |
| 15 |
mixin("int i" ~ cast(char)('0' + t) ~ " = 5;"); |
| 16 |
} |
| 17 |
|
| 18 |
void test19479() |
| 19 |
{ |
| 20 |
{ |
| 21 |
static foreach (t; 0..1) |
| 22 |
int i = 5; |
| 23 |
assert(i == 5); |
| 24 |
} |
| 25 |
{ |
| 26 |
mixin genInts19479a!(); |
| 27 |
assert(i == 5); |
| 28 |
} |
| 29 |
{ |
| 30 |
static foreach (t; 0..2) |
| 31 |
mixin("int i" ~ cast(char)('0' + t) ~ " = 5;"); |
| 32 |
assert(i0 == 5); |
| 33 |
assert(i1 == 5); |
| 34 |
} |
| 35 |
{ |
| 36 |
mixin genInts19479b!(); |
| 37 |
assert(i0 == 5); |
| 38 |
assert(i1 == 5); |
| 39 |
} |
| 40 |
} |
| 41 |
|
| 42 |
/**********************************/ |
| 43 |
// https://issues.dlang.org/show_bug.cgi?id=23192 |
| 44 |
|
| 45 |
alias AliasSeq(Args...) = Args; |
| 46 |
|
| 47 |
struct S23192 |
| 48 |
{ |
| 49 |
int x; |
| 50 |
int y; |
| 51 |
|
| 52 |
int fun() |
| 53 |
{ |
| 54 |
static foreach (sym; AliasSeq!(S23192.x)) |
| 55 |
int i = sym; |
| 56 |
|
| 57 |
static foreach (sym; AliasSeq!(this.y)) |
| 58 |
int j = sym; |
| 59 |
|
| 60 |
return i + j; |
| 61 |
} |
| 62 |
} |
| 63 |
|
| 64 |
void test23192() |
| 65 |
{ |
| 66 |
assert(S23192(1, 2).fun() == 3); |
| 67 |
static assert(S23192(1, 2).fun() == 3); |
| 68 |
} |
| 69 |
|
| 70 |
void main() |
| 71 |
{ |
| 72 |
test19479(); |
| 73 |
test23192(); |
| 74 |
} |