Skip to content

Commit

Permalink
Fix Bugzilla Issue 24760 - ICE on variadic after default argument
Browse files Browse the repository at this point in the history
  • Loading branch information
RazvanN7 authored and dlang-bot committed Sep 12, 2024
1 parent 8b0bdc3 commit 752c9c6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion dmd/typesem.d
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,9 @@ extern (D) MATCH callMatch(TypeFunction tf, Type tthis, ArgumentList argumentLis
L1:
if (parameterList.varargs == VarArg.typesafe && u + 1 == nparams) // if last varargs param
{
auto trailingArgs = args[u .. $];
Expression[] trailingArgs;
if (args.length >= u)
trailingArgs = args[u .. $];
if (auto vmatch = matchTypeSafeVarArgs(tf, p, trailingArgs, pMessage))
return vmatch < match ? vmatch : match;
// Error message was already generated in `matchTypeSafeVarArgs`
Expand Down
4 changes: 4 additions & 0 deletions tests/dmd/compilable/test24760.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// https://issues.dlang.org/show_bug.cgi?id=24760

long f(int e = 0, uint[] optional...) => optional.length;
long f0() => f(); // compiler segfaults

0 comments on commit 752c9c6

Please sign in to comment.