@@ -3051,10 +3051,14 @@ void Parser::CompleteIfSpecializationType(const clang::QualType& QualType)
30513051 SemaDiagnostics->Decl = CTS;
30523052 c->getSema ().getDiagnostics ().setClient (SemaDiagnostics.get (), false );
30533053
3054+ Scope Scope (nullptr , Scope::ScopeFlags::ClassScope, c->getSema ().getDiagnostics ());
3055+ c->getSema ().TUScope = &Scope;
3056+
30543057 c->getSema ().InstantiateClassTemplateSpecialization (CTS->getBeginLoc (),
30553058 CTS, TSK_ImplicitInstantiation, false );
30563059
30573060 c->getSema ().getDiagnostics ().setClient (existingClient, false );
3061+ c->getSema ().TUScope = nullptr ;
30583062
30593063 auto CT = WalkClassTemplate (CTS->getSpecializedTemplate ());
30603064 auto USR = GetDeclUSR (CTS);
@@ -3178,6 +3182,9 @@ void Parser::MarkValidity(Function* F)
31783182 SemaDiagnostics->Decl = FD;
31793183 c->getSema ().getDiagnostics ().setClient (SemaDiagnostics.get (), false );
31803184
3185+ Scope Scope (nullptr , Scope::ScopeFlags::FnScope, c->getSema ().getDiagnostics ());
3186+ c->getSema ().TUScope = &Scope;
3187+
31813188 c->getSema ().InstantiateFunctionDefinition (FD->getBeginLoc (), FD,
31823189 /* Recursive*/ true );
31833190 F->isInvalid = FD->isInvalidDecl ();
@@ -3188,6 +3195,7 @@ void Parser::MarkValidity(Function* F)
31883195 }
31893196
31903197 c->getSema ().getDiagnostics ().setClient (existingClient, false );
3198+ c->getSema ().TUScope = nullptr ;
31913199}
31923200
31933201void Parser::WalkFunction (const clang::FunctionDecl* FD, Function* F)
0 commit comments