mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-12 02:43:14 +01:00
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(-)
This commit is contained in:
@@ -663,7 +663,7 @@ void functionParameters(Loc loc, Scope *sc, TypeFunction *tf, Expressions *argum
|
||||
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 @@ void functionParameters(Loc loc, Scope *sc, TypeFunction *tf, Expressions *argum
|
||||
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 @@ void functionParameters(Loc loc, Scope *sc, TypeFunction *tf, Expressions *argum
|
||||
// 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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user