# HG changeset patch # User Frits van Bommel # Date 1238363871 -7200 # Node ID a8b9fc41c34b1ed44eddd55cc55556681b93a1c5 # Parent 34321f120882e5984b87503d7813af37a0f546ae Fix #246 by running type->semantic() on parameters so tuples are expanded. diff -r 34321f120882 -r a8b9fc41c34b dmd/func.c --- a/dmd/func.c Sun Mar 29 19:46:37 2009 +0200 +++ b/dmd/func.c Sun Mar 29 23:57:51 2009 +0200 @@ -769,6 +769,30 @@ } } +#if IN_LLVM + // LDC make sure argument type is semanticed. + // Turns TypeTuple!(int, int) into two int parameters, for instance. + if (f->parameters) + { + for (size_t i = 0; i < Argument::dim(f->parameters); i++) + { Argument *arg = (Argument *)Argument::getNth(f->parameters, i); + Type* nw = arg->type->semantic(0, sc); + if (arg->type != nw) { + arg->type = nw; + // Examine this index again. + // This is important if it turned into a tuple. + // In particular, the empty tuple should be handled or the + // next parameter will be skipped. + // FIXME: Maybe we only need to do this for tuples, + // and can add tuple.length after decrement? + i--; + } + } + // update nparams to include expanded tuples + nparams = Argument::dim(f->parameters); + } +#endif + // Propagate storage class from tuple parameters to their element-parameters. if (f->parameters) {