| 1 |
// https://issues.dlang.org/show_bug.cgi?id=854 |
| 2 |
// TypeTuple in anonymous delegate causes ice in glue.c |
| 3 |
|
| 4 |
/* 854 VOTE PATCH (=2863, =2251?) Assertion failure: '0' on line 935 in file 'glue.c' |
| 5 |
I haven't checked this patch myself. |
| 6 |
--- dmd/func.c 2009-03-05 01:56:46.000000000 +0100 |
| 7 |
+++ dmd-fixed/func.c 2009-03-30 00:39:41.000000000 +0200 |
| 8 |
@@ -756,6 +756,27 @@ |
| 9 |
} |
| 10 |
} |
| 11 |
|
| 12 |
+ if (f->parameters) |
| 13 |
+ { |
| 14 |
+ for (size_t i = 0; i < Argument::dim(f->parameters); i++) |
| 15 |
+ { |
| 16 |
+ Argument *arg = (Argument *)Argument::getNth(f->parameters, i); |
| 17 |
+ Type* nw = arg->type->semantic(0, sc); |
| 18 |
+ if (arg->type != nw) { |
| 19 |
+ arg->type = nw; |
| 20 |
+ // Examine this index again. |
| 21 |
+ // This is important if it turned into a tuple. |
| 22 |
+ // In particular, the empty tuple should be handled or the |
| 23 |
+ // next parameter will be skipped. |
| 24 |
+ // FIXME: Maybe we only need to do this for tuples, |
| 25 |
+ // and can add tuple.length after decrement? |
| 26 |
+ i--; |
| 27 |
+ } |
| 28 |
+ } |
| 29 |
+ // update nparams to include expanded tuples |
| 30 |
+ nparams = Argument::dim(f->parameters); |
| 31 |
+ } |
| 32 |
+ |
| 33 |
// Propagate storage class from tuple parameters to their element-parameters. |
| 34 |
if (f->parameters) |
| 35 |
{ |
| 36 |
*/ |
| 37 |
template Foo(T...) |
| 38 |
{ |
| 39 |
alias T Foo; |
| 40 |
} |
| 41 |
void main() |
| 42 |
{ |
| 43 |
auto y = (Foo!(int) x){ return 0; }; |
| 44 |
} |