Parse: Fix crash in error recovery path with specifier before parameter name

We should let Sema set ParamDecl's specifier always, instead of setting
it in the parser in this odd corner case where we're recovering from
'inout' being written before the parameter name.
This commit is contained in:
Slava Pestov
2018-06-06 16:21:51 -07:00
parent c968a2014a
commit 7f9d364bac
2 changed files with 5 additions and 1 deletions

View File

@@ -425,7 +425,7 @@ mapParsedParameters(Parser &parser,
Identifier argName, SourceLoc argNameLoc,
Identifier paramName, SourceLoc paramNameLoc)
-> ParamDecl * {
auto param = new (ctx) ParamDecl(paramInfo.SpecifierKind,
auto param = new (ctx) ParamDecl(VarDecl::Specifier::Default,
paramInfo.SpecifierLoc,
argNameLoc, argName,
paramNameLoc, paramName, Type(),