From 5cec19dc1aabeda486aa47845f82fb67a5a899b4 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Tue, 27 Nov 2018 02:21:51 +0000 Subject: [MS] Push fewer DeclContexts for delayed template parsing Only push the outermost record as a DeclContext when parsing a function body. See the comments in Sema::getContainingDC about the way the parser pushes contexts. This is intended to match the behavior the parser normally displays where it parses all method bodies from all nested classes at the end of the outermost class, when all nested classes are complete. Fixes PR38460. llvm-svn: 347627 --- clang/test/Parser/DelayedTemplateParsing.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'clang/test/Parser/DelayedTemplateParsing.cpp') diff --git a/clang/test/Parser/DelayedTemplateParsing.cpp b/clang/test/Parser/DelayedTemplateParsing.cpp index 6ea245c2d4e..301eacfabba 100644 --- a/clang/test/Parser/DelayedTemplateParsing.cpp +++ b/clang/test/Parser/DelayedTemplateParsing.cpp @@ -181,3 +181,20 @@ 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(); +} -- cgit v1.2.3