From 0f1f12931f7259f1f78b053094a80ff5407ab092 Mon Sep 17 00:00:00 2001 From: Axel Naumann Date: Mon, 7 Nov 2016 15:03:38 +0100 Subject: [PATCH] In the RAII ctor, set private Parser fields to default values. --- interpreter/cling/lib/Utils/ParserStateRAII.cpp | 6 ++++++ .../llvm/src/tools/clang/lib/Sema/SemaCXXScopeSpec.cpp | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/interpreter/cling/lib/Utils/ParserStateRAII.cpp b/interpreter/cling/lib/Utils/ParserStateRAII.cpp index 60a69024cd253..a3f6e0f9a6709 100644 --- a/interpreter/cling/lib/Utils/ParserStateRAII.cpp +++ b/interpreter/cling/lib/Utils/ParserStateRAII.cpp @@ -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() { diff --git a/interpreter/llvm/src/tools/clang/lib/Sema/SemaCXXScopeSpec.cpp b/interpreter/llvm/src/tools/clang/lib/Sema/SemaCXXScopeSpec.cpp index 1d9ceb98a425a..5b80bb9018494 100644 --- a/interpreter/llvm/src/tools/clang/lib/Sema/SemaCXXScopeSpec.cpp +++ b/interpreter/llvm/src/tools/clang/lib/Sema/SemaCXXScopeSpec.cpp @@ -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();