From: Reid Kleckner Date: Tue, 27 Nov 2018 02:54:17 +0000 (+0000) Subject: Revert r347627 "[MS] Push fewer DeclContexts for delayed template parsing" X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=32cf310e2886414c9e3c3b22d1336b259dd59288;p=clang Revert r347627 "[MS] Push fewer DeclContexts for delayed template parsing" It broke the Windows self-host: http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/1799/steps/stage%202%20build/logs/stdio I can build lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/MachinePostDominators.cpp.obj to repro. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@347630 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Parse/ParseTemplate.cpp b/lib/Parse/ParseTemplate.cpp index 55f80f231f..26709a5aaa 100644 --- a/lib/Parse/ParseTemplate.cpp +++ b/lib/Parse/ParseTemplate.cpp @@ -1382,7 +1382,7 @@ void Parser::ParseLateTemplatedFuncDef(LateParsedTemplate &LPT) { SmallVector TemplateParamScopeStack; // Get the list of DeclContexts to reenter. - SmallVector DeclContextsToReenter; + SmallVector DeclContextsToReenter; DeclContext *DD = FunD; while (DD && !DD->isTranslationUnit()) { DeclContextsToReenter.push_back(DD); @@ -1398,12 +1398,7 @@ void Parser::ParseLateTemplatedFuncDef(LateParsedTemplate &LPT) { unsigned NumParamLists = Actions.ActOnReenterTemplateScope(getCurScope(), cast(*II)); CurTemplateDepthTracker.addDepth(NumParamLists); - // If we find a class in a class, we need to push the context of the - // outermost class to match up with how we would parse a regular C++ class - // inline method. - if (*II != FunD && - !(isa(*II) && isa(Actions.CurContext) && - Actions.CurContext == (*II)->getLexicalParent())) { + if (*II != FunD) { TemplateParamScopeStack.push_back(new ParseScope(this, Scope::DeclScope)); Actions.PushDeclContext(Actions.getCurScope(), *II); } diff --git a/test/Parser/DelayedTemplateParsing.cpp b/test/Parser/DelayedTemplateParsing.cpp index 301eacfabb..6ea245c2d4 100644 --- a/test/Parser/DelayedTemplateParsing.cpp +++ b/test/Parser/DelayedTemplateParsing.cpp @@ -181,20 +181,3 @@ static void h() { } } - -struct PR38460 { - template - struct T { - static void foo() { - struct U { - void dummy() { - use_delayed_identifier(); - } - }; - } - }; -}; -void use_delayed_identifier(); -void trigger_PR38460() { - PR38460::T::foo(); -}