@@ -3051,10 +3051,14 @@ void Parser::CompleteIfSpecializationType(const clang::QualType& QualType)
3051
3051
SemaDiagnostics->Decl = CTS;
3052
3052
c->getSema ().getDiagnostics ().setClient (SemaDiagnostics.get (), false );
3053
3053
3054
+ Scope Scope (nullptr , Scope::ScopeFlags::ClassScope, c->getSema ().getDiagnostics ());
3055
+ c->getSema ().TUScope = &Scope;
3056
+
3054
3057
c->getSema ().InstantiateClassTemplateSpecialization (CTS->getBeginLoc (),
3055
3058
CTS, TSK_ImplicitInstantiation, false );
3056
3059
3057
3060
c->getSema ().getDiagnostics ().setClient (existingClient, false );
3061
+ c->getSema ().TUScope = nullptr ;
3058
3062
3059
3063
auto CT = WalkClassTemplate (CTS->getSpecializedTemplate ());
3060
3064
auto USR = GetDeclUSR (CTS);
@@ -3178,6 +3182,9 @@ void Parser::MarkValidity(Function* F)
3178
3182
SemaDiagnostics->Decl = FD;
3179
3183
c->getSema ().getDiagnostics ().setClient (SemaDiagnostics.get (), false );
3180
3184
3185
+ Scope Scope (nullptr , Scope::ScopeFlags::FnScope, c->getSema ().getDiagnostics ());
3186
+ c->getSema ().TUScope = &Scope;
3187
+
3181
3188
c->getSema ().InstantiateFunctionDefinition (FD->getBeginLoc (), FD,
3182
3189
/* Recursive*/ true );
3183
3190
F->isInvalid = FD->isInvalidDecl ();
@@ -3188,6 +3195,7 @@ void Parser::MarkValidity(Function* F)
3188
3195
}
3189
3196
3190
3197
c->getSema ().getDiagnostics ().setClient (existingClient, false );
3198
+ c->getSema ().TUScope = nullptr ;
3191
3199
}
3192
3200
3193
3201
void Parser::WalkFunction (const clang::FunctionDecl* FD, Function* F)
0 commit comments