Skip to content

Commit

Permalink
In the RAII ctor, set private Parser fields to default values.
Browse files Browse the repository at this point in the history
  • Loading branch information
Axel-Naumann committed Nov 7, 2016
1 parent 2e4cf96 commit 0f1f129
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions interpreter/cling/lib/Utils/ParserStateRAII.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ cling::ParserStateRAII::ParserStateRAII(Parser& p)
OldInNonInstantiationSFINAEContext(P->getActions()
.InNonInstantiationSFINAEContext)
{
// Set to defaults, reset to previous values by ~ParserStateRAII().
OldTemplateIds.swap(P->TemplateIds);
P->ParenCount = 0;
P->BracketCount = 0;
P->BraceCount = 0;
P->TemplateParameterDepth = 0;
P->getActions().InNonInstantiationSFINAEContext = false;
}

cling::ParserStateRAII::~ParserStateRAII() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ DeclContext *Sema::computeDeclContext(const CXXScopeSpec &SS,
// into that class template definition.
QualType Injected
= ClassTemplate->getInjectedClassNameSpecialization();

// Injected might not be canonical
Injected = Injected.getCanonicalType();

if (Context.hasSameType(Injected, ContextType))
return ClassTemplate->getTemplatedDecl();

Expand Down

0 comments on commit 0f1f129

Please sign in to comment.