aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplateDeduction.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-04-29 00:35:03 +0000
committerJohn McCall <rjmccall@apple.com>2010-04-29 00:35:03 +0000
commitf5813826802c2e76cdc13cae834ebfd4518d74a6 (patch)
treef213a546ee469fd7cf7af44cd85ae0bcaf2f0023 /lib/Sema/SemaTemplateDeduction.cpp
parentcc8a5d5f90bbbbcb46f342117b851b7e07ec34f1 (diff)
Properly switch into the declaring scope of a template when performing
template argument deduction or (more importantly) the final substitution required by such deduction. Makes access control magically work in these cases. Fixes PR6967. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102572 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateDeduction.cpp')
-rw-r--r--lib/Sema/SemaTemplateDeduction.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp
index 0a2c5ae00e..13bfc0fdf9 100644
--- a/lib/Sema/SemaTemplateDeduction.cpp
+++ b/lib/Sema/SemaTemplateDeduction.cpp
@@ -988,6 +988,8 @@ Sema::DeduceTemplateArguments(ClassTemplatePartialSpecializationDecl *Partial,
if (Inst)
return TDK_InstantiationDepth;
+ ContextRAII SavedContext(*this, Partial->getDeclContext());
+
// C++ [temp.deduct.type]p2:
// [...] or if any template argument remains neither deduced nor
// explicitly specified, template argument deduction fails.
@@ -1163,6 +1165,8 @@ Sema::SubstituteExplicitTemplateArguments(
if (Inst)
return TDK_InstantiationDepth;
+ ContextRAII SavedContext(*this, FunctionTemplate->getDeclContext());
+
if (CheckTemplateArgumentList(FunctionTemplate,
SourceLocation(),
ExplicitTemplateArgs,
@@ -1311,6 +1315,8 @@ Sema::FinishTemplateArgumentDeduction(FunctionTemplateDecl *FunctionTemplate,
if (Inst)
return TDK_InstantiationDepth;
+ ContextRAII SavedContext(*this, FunctionTemplate->getDeclContext());
+
// C++ [temp.deduct.type]p2:
// [...] or if any template argument remains neither deduced nor
// explicitly specified, template argument deduction fails.