# HG changeset patch # User Leandro Lucarella # Date 1262801901 10800 # Node ID 3f728445fc4211060c21e8c07677212b858818e6 # Parent 4f63d530861f447569f28d4a09c4e819c118d6fe Merge DMD r277: bugzilla 3495 Segfault(typinf.c) instantiating D variadic... bugzilla 3495 Segfault(typinf.c) instantiating D variadic function with too few arguments. --- dmd/expression.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff -r 4f63d530861f -r 3f728445fc42 dmd/expression.c --- a/dmd/expression.c Wed Jan 06 15:18:21 2010 -0300 +++ b/dmd/expression.c Wed Jan 06 15:18:21 2010 -0300 @@ -663,7 +663,7 @@ if (tf->varargs == 2 && i + 1 == nparams) goto L2; error(loc, "expected %zu function arguments, not %zu", nparams, nargs); - break; + return; } arg = p->defaultArg; #if DMDV2 @@ -684,7 +684,9 @@ if (arg->implicitConvTo(p->type)) { if (nargs != nparams) - error(loc, "expected %zu function arguments, not %zu", nparams, nargs); + { error(loc, "expected %zu function arguments, not %zu", nparams, nargs); + return; + } goto L1; } L2: @@ -900,9 +902,8 @@ // If D linkage and variadic, add _arguments[] as first argument if (tf->linkage == LINKd && tf->varargs == 1) { - Expression *e; - - e = createTypeInfoArray(sc, (Expression **)&arguments->data[nparams], + assert(arguments->dim >= nparams); + Expression *e = createTypeInfoArray(sc, (Expression **)&arguments->data[nparams], arguments->dim - nparams); arguments->insert(0, e); }