diff --git a/compiler/src/dmd/parse.d b/compiler/src/dmd/parse.d index bb2411825fae..5b73da1b976c 100644 --- a/compiler/src/dmd/parse.d +++ b/compiler/src/dmd/parse.d @@ -2974,7 +2974,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer const tv = peekNext(); Loc loc; if (tpl && token.value == TOK.identifier && - (tv == TOK.comma || tv == TOK.rightParenthesis || tv == TOK.dotDotDot)) + (tv == TOK.comma || tv == TOK.rightParenthesis || tv == TOK.dotDotDot || tv == TOK.assign)) { Identifier id = Identifier.generateId("__T"); loc = token.loc; diff --git a/compiler/test/runnable/lambdadefault.d b/compiler/test/runnable/lambdadefault.d new file mode 100644 index 000000000000..f97971c45219 --- /dev/null +++ b/compiler/test/runnable/lambdadefault.d @@ -0,0 +1,5 @@ +alias fp = (x = 0) => x; +static assert(is(typeof(fp!int) : int function(int = 0))); +static assert(fp() == 0); + +int main() {}