@@ -1272,7 +1272,7 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D,
12721272 // tokens and store them for late parsing at the end of the translation unit.
12731273 if (getLangOpts ().DelayedTemplateParsing && Tok.isNot (tok::equal) &&
12741274 TemplateInfo.Kind == ParsedTemplateKind::Template &&
1275- Actions.canDelayFunctionBody (D)) {
1275+ LateParsedAttrs-> empty () && Actions.canDelayFunctionBody (D)) {
12761276 MultiTemplateParamsArg TemplateParameterLists (*TemplateInfo.TemplateParams );
12771277
12781278 ParseScope BodyScope (this , Scope::FnScope | Scope::DeclScope |
@@ -1301,10 +1301,8 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D,
13011301 }
13021302 return DP;
13031303 }
1304- else if (CurParsedObjCImpl &&
1305- !TemplateInfo.TemplateParams &&
1306- (Tok.is (tok::l_brace) || Tok.is (tok::kw_try) ||
1307- Tok.is (tok::colon)) &&
1304+ if (CurParsedObjCImpl && !TemplateInfo.TemplateParams &&
1305+ (Tok.is (tok::l_brace) || Tok.is (tok::kw_try) || Tok.is (tok::colon)) &&
13081306 Actions.CurContext ->isTranslationUnit ()) {
13091307 ParseScope BodyScope (this , Scope::FnScope | Scope::DeclScope |
13101308 Scope::CompoundStmtScope);
@@ -1420,7 +1418,8 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D,
14201418
14211419 // Late attributes are parsed in the same scope as the function body.
14221420 if (LateParsedAttrs)
1423- ParseLexedAttributeList (*LateParsedAttrs, Res, false , true );
1421+ ParseLexedAttributeList (*LateParsedAttrs, Res, /* EnterScope=*/ false ,
1422+ /* OnDefinition=*/ true );
14241423
14251424 if (SkipFunctionBodies && (!Res || Actions.canSkipFunctionBody (Res)) &&
14261425 trySkippingFunctionBody ()) {
0 commit comments