diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-05-11 23:09:06 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-05-11 23:09:06 +0000 |
commit | b77cc7f4eb3d35189e8cd904eafe9d0fc817dcfc (patch) | |
tree | 1f05bc12326447f280995a3a0e570d9aaa539217 /lib/Parse/ParseTemplate.cpp | |
parent | f2cb5a349eeb05f95d72ab5223c463e3cc272fd8 (diff) |
PR20625: Instantiate static constexpr member function of a local struct in a function template earlier.
This is necessary in order to allow the use of a constexpr member function, or
a member function with deduced return type, of a local class within a
surrounding instantiated function template specialization.
Patch by Michael Park!
This re-commits r236063, which was reverted in r236134, along with a fix for a
delayed template parsing bug that was exposed by this change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237064 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseTemplate.cpp')
-rw-r--r-- | lib/Parse/ParseTemplate.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Parse/ParseTemplate.cpp b/lib/Parse/ParseTemplate.cpp index 53de72cd3c..f1467fe553 100644 --- a/lib/Parse/ParseTemplate.cpp +++ b/lib/Parse/ParseTemplate.cpp @@ -14,6 +14,7 @@ #include "clang/Parse/Parser.h" #include "RAIIObjectsForParser.h" #include "clang/AST/ASTConsumer.h" +#include "clang/AST/ASTContext.h" #include "clang/AST/DeclTemplate.h" #include "clang/Parse/ParseDiagnostic.h" #include "clang/Sema/DeclSpec.h" @@ -1301,7 +1302,8 @@ void Parser::ParseLateTemplatedFuncDef(LateParsedTemplate &LPT) { TemplateParameterDepthRAII CurTemplateDepthTracker(TemplateParameterDepth); // To restore the context after late parsing. - Sema::ContextRAII GlobalSavedContext(Actions, Actions.CurContext); + Sema::ContextRAII GlobalSavedContext( + Actions, Actions.Context.getTranslationUnitDecl()); SmallVector<ParseScope*, 4> TemplateParamScopeStack; |