Mercurial > projects > ldc
changeset 1611:3f728445fc42
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(-)
author | Leandro Lucarella <llucax@gmail.com> |
---|---|
date | Wed, 06 Jan 2010 15:18:21 -0300 |
parents | 4f63d530861f |
children | 081c48283153 |
files | dmd/expression.c |
diffstat | 1 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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); }