diff options
Diffstat (limited to 'clang/lib/Parse/ParseCXXInlineMethods.cpp')
-rw-r--r-- | clang/lib/Parse/ParseCXXInlineMethods.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/clang/lib/Parse/ParseCXXInlineMethods.cpp b/clang/lib/Parse/ParseCXXInlineMethods.cpp index 6f13b9dc29c..a53079b260d 100644 --- a/clang/lib/Parse/ParseCXXInlineMethods.cpp +++ b/clang/lib/Parse/ParseCXXInlineMethods.cpp @@ -306,8 +306,9 @@ void Parser::ParseLexedMethodDeclaration(LateParsedMethodDeclaration &LM) { ParseScope PrototypeScope(this, Scope::FunctionPrototypeScope | Scope::FunctionDeclarationScope | Scope::DeclScope); for (unsigned I = 0, N = LM.DefaultArgs.size(); I != N; ++I) { - auto Param = LM.DefaultArgs[I].Param; + auto Param = cast<ParmVarDecl>(LM.DefaultArgs[I].Param); // Introduce the parameter into scope. + bool HasUnparsed = Param->hasUnparsedDefaultArg(); Actions.ActOnDelayedCXXMethodParameter(getCurScope(), Param); if (CachedTokens *Toks = LM.DefaultArgs[I].Toks) { // Mark the end of the default argument so that we know when to stop when @@ -371,6 +372,16 @@ void Parser::ParseLexedMethodDeclaration(LateParsedMethodDeclaration &LM) { delete Toks; LM.DefaultArgs[I].Toks = nullptr; + } else if (HasUnparsed) { + assert(Param->hasInheritedDefaultArg()); + FunctionDecl *Old = cast<FunctionDecl>(LM.Method)->getPreviousDecl(); + ParmVarDecl *OldParam = Old->getParamDecl(I); + assert (!OldParam->hasUnparsedDefaultArg()); + if (OldParam->hasUninstantiatedDefaultArg()) + Param->setUninstantiatedDefaultArg( + Param->getUninstantiatedDefaultArg()); + else + Param->setDefaultArg(OldParam->getInit()); } } |